You are here

public function DefaultProcessor::delete in Drupal 9

Same name and namespace in other branches
  1. 8 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(t('The news items from %site have been deleted.', [
    '%site' => $feed
      ->label(),
  ]));
}