diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index b544908..68b8fae 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -142,10 +142,8 @@ function aggregator_menu() { ); $items['aggregator'] = array( 'title' => 'Feed aggregator', - 'page callback' => 'aggregator_page_last', - 'access arguments' => array('access news feeds'), 'weight' => 5, - 'file' => 'aggregator.pages.inc', + 'route_name' => 'aggregator_page_last', ); $items['aggregator/sources'] = array( 'title' => 'Sources', diff --git a/core/modules/aggregator/aggregator.routing.yml b/core/modules/aggregator/aggregator.routing.yml index bf02d5c..85394d2 100644 --- a/core/modules/aggregator/aggregator.routing.yml +++ b/core/modules/aggregator/aggregator.routing.yml @@ -25,3 +25,10 @@ aggregator_feed_add: _controller: '\Drupal\aggregator\Routing\AggregatorController::feedAdd' requirements: _permission: 'administer news feeds' + +aggregator_page_last: + pattern: '/aggregator' + defaults: + _controller: '\Drupal\aggregator\Routing\AggregatorController::pageLast' + requirements: + _permission: 'access news feeds' diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php index 66f1fbd..cf21e5a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php @@ -56,4 +56,21 @@ public function feedAdd() { return entity_get_form($feed); } + /** + * Displays the most recent items gathered from any feed. + * + * @return string + * The rendered list of items for the feed. + */ + public function pageLast() { + + drupal_add_feed('aggregator/rss', config('system.site')->get('name') . ' ' . t('aggregator')); + + // TODO move this function to controller. + module_load_include('inc', 'aggregator', 'aggregator.pages'); + $items = aggregator_load_feed_items('sum'); + + // TODO move this function to controller. + return _aggregator_page_list($items, arg(1)); + } }