function DefaultProcessor::delete

Same name and namespace in other branches
  1. 8.9.x core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php \Drupal\aggregator\Plugin\aggregator\processor\DefaultProcessor::delete()

Deletes stored feed data.

Called by aggregator if either a feed is deleted or a user clicks on "delete items".

Parameters

\Drupal\aggregator\FeedInterface $feed: The $feed object whose items are being deleted.

Overrides ProcessorInterface::delete

File

core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php, line 242

Class

DefaultProcessor
Defines a default processor implementation.

Namespace

Drupal\aggregator\Plugin\aggregator\processor

Code

public function delete(FeedInterface $feed) {
    if ($items = $this->itemStorage
        ->loadByFeed($feed->id())) {
        $this->itemStorage
            ->delete($items);
    }
    // @todo This should be moved out to caller with a different message maybe.
    $this->messenger
        ->addStatus($this->t('The news items from %site have been deleted.', [
        '%site' => $feed->label(),
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.