function aggregator_remove

8.x aggregator.module aggregator_remove(Feed $feed)

Removes all items from a feed.

Parameters

\Drupal\aggregator\Plugin\Core\Entity\Feed $feed: An object describing the feed to be cleared.

File

drupal/core/modules/aggregator/aggregator.module, line 379
Used to aggregate syndicated content (RSS, RDF, and Atom).

Code

function aggregator_remove(Feed $feed) {
  // Call \Drupal\aggregator\Plugin\ProcessorInterface::remove() on all
  // processors.
  $manager = Drupal::service('plugin.manager.aggregator.processor');
  foreach ($manager->getDefinitions() as $id => $definition) {
    $manager->createInstance($id)->remove($feed);
  }
  // Reset feed.
  $feed->checked->value = 0;
  $feed->hash->value = '';
  $feed->etag->value = '';
  $feed->modified->value = 0;
  $feed->save();
}