public function AggregatorController::sources

Displays all the feeds used by the Aggregator module.

Return value

array A render array as expected by drupal_render().

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

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php, line 239
Contains \Drupal\aggregator\Controller\AggregatorController.

Class

AggregatorController
Returns responses for aggregator module routes.

Namespace

Drupal\aggregator\Controller

Code

public function sources() {
  $feeds = $this->entityManager
    ->getStorageController('aggregator_feed')
    ->load();
  $build = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'aggregator-wrapper',
      ),
    ),
    '#sorted' => TRUE,
  );

  // @todo remove this once aggregator_load_feed_items() is refactored after
  // http://drupal.org/node/15266 is in.
  $this->moduleHandler
    ->loadInclude('aggregator', 'inc', 'aggregator.pages');
  foreach ($feeds as $feed) {

    // Most recent items:
    $summary_items = array();
    $aggregator_summary_items = $this->configFactory
      ->get('aggregator.settings')
      ->get('source.list_max');
    if ($aggregator_summary_items) {
      if ($items = aggregator_load_feed_items('source', $feed, $aggregator_summary_items)) {
        $summary_items = $this->entityManager
          ->getRenderController('aggregator_item')
          ->viewMultiple($items, 'summary');
      }
    }
    $feed->url = url('aggregator/sources/' . $feed
      ->id());
    $build[$feed
      ->id()] = array(
      '#theme' => 'aggregator_summary_items',
      '#summary_items' => $summary_items,
      '#source' => $feed,
    );
  }
  $build['feed_icon'] = array(
    '#theme' => 'feed_icon',
    '#url' => 'aggregator/opml',
    '#title' => t('OPML feed'),
  );
  return $build;
}