You are here

protected function AggregatorController::buildPageList in Drupal 9

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

Builds a listing of aggregator feed items.

Parameters

\Drupal\aggregator\ItemInterface[] $items: The items to be listed.

array|string $feed_source: The feed source URL.

Return value

array The rendered list of items for the feed.

1 call to AggregatorController::buildPageList()
AggregatorController::pageLast in core/modules/aggregator/src/Controller/AggregatorController.php
Displays the most recent items gathered from any feed.

File

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

Class

AggregatorController
Returns responses for aggregator module routes.

Namespace

Drupal\aggregator\Controller

Code

protected function buildPageList(array $items, $feed_source = '') {

  // Assemble output.
  $build = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'aggregator-wrapper',
      ],
    ],
  ];
  $build['feed_source'] = is_array($feed_source) ? $feed_source : [
    '#markup' => $feed_source,
  ];
  if ($items) {
    $build['items'] = $this
      ->entityTypeManager()
      ->getViewBuilder('aggregator_item')
      ->viewMultiple($items, 'default');
    $build['pager'] = [
      '#type' => 'pager',
    ];
  }
  return $build;
}