Displays all the feeds used by the Aggregator module.
array A render array as expected by drupal_render().
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;
}