You are here

public function Feed::refreshItems in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/aggregator/src/Entity/Feed.php \Drupal\aggregator\Entity\Feed::refreshItems()

Updates the feed items by triggering the import process.

This will also update the last checked time of the feed and save it.

Return value

bool TRUE if there is new content for the feed FALSE otherwise.

Overrides FeedInterface::refreshItems

See also

\Drupal\aggregator\ItemsImporterInterface::refresh()

File

core/modules/aggregator/src/Entity/Feed.php, line 84

Class

Feed
Defines the aggregator feed entity class.

Namespace

Drupal\aggregator\Entity

Code

public function refreshItems() {
  $success = \Drupal::service('aggregator.items.importer')
    ->refresh($this);

  // Regardless of successful or not, indicate that it has been checked.
  $this
    ->setLastCheckedTime(REQUEST_TIME);
  $this
    ->setQueuedTime(0);
  $this
    ->save();
  return $success;
}