You are here

public function AggregatorController::feedRefresh in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/aggregator/src/Controller/AggregatorController.php \Drupal\aggregator\Controller\AggregatorController::feedRefresh()

Refreshes a feed, then redirects to the overview page.

Parameters

\Drupal\aggregator\FeedInterface $aggregator_feed: An object describing the feed to be refreshed.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirection to the admin overview page.

Throws

\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException If the query token is missing or invalid.

1 string reference to 'AggregatorController::feedRefresh'
aggregator.routing.yml in core/modules/aggregator/aggregator.routing.yml
core/modules/aggregator/aggregator.routing.yml

File

core/modules/aggregator/src/Controller/AggregatorController.php, line 93

Class

AggregatorController
Returns responses for aggregator module routes.

Namespace

Drupal\aggregator\Controller

Code

public function feedRefresh(FeedInterface $aggregator_feed) {
  $message = $aggregator_feed
    ->refreshItems() ? $this
    ->t('There is new syndicated content from %site.', [
    '%site' => $aggregator_feed
      ->label(),
  ]) : $this
    ->t('There is no new syndicated content from %site.', [
    '%site' => $aggregator_feed
      ->label(),
  ]);
  $this
    ->messenger()
    ->addStatus($message);
  return $this
    ->redirect('aggregator.admin_overview');
}