diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 25265f4..e5336d2 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -137,10 +137,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.pages.inc b/core/modules/aggregator/aggregator.pages.inc index 6248012..10ba125 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -9,22 +9,6 @@ use Drupal\Core\Entity\EntityInterface; /** - * Page callback: Displays the most recent items gathered from any feed. - * - * @return string - * The rendered list of items for the feed. - * - * @see aggregator_menu() - */ -function aggregator_page_last() { - drupal_add_feed('aggregator/rss', config('system.site')->get('name') . ' ' . t('aggregator')); - - $items = aggregator_load_feed_items('sum'); - - return _aggregator_page_list($items, arg(1)); -} - -/** * Page callback: Displays all the items captured from the particular feed. * * @param \Drupal\aggregator\Plugin\Core\Entity\Feed $feed diff --git a/core/modules/aggregator/aggregator.routing.yml b/core/modules/aggregator/aggregator.routing.yml index c41cf0e..e1b48ca 100644 --- a/core/modules/aggregator/aggregator.routing.yml +++ b/core/modules/aggregator/aggregator.routing.yml @@ -39,3 +39,10 @@ aggregator_opml_add: _form: '\Drupal\aggregator\Form\OpmlFeedAdd' 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 ff2b222..7b12038 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php @@ -7,10 +7,11 @@ namespace Drupal\aggregator\Routing; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal; use Drupal\Core\ControllerInterface; use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityManager; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Returns responses for aggregator module routes. @@ -153,4 +154,23 @@ public function adminOverview() { return $build; } + /** + * 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 Remove this function once after all controller conversions are + // done. + Drupal::moduleHandler()->loadInclude('aggregator', 'inc', 'aggregator.pages'); + $items = aggregator_load_feed_items('sum'); + + // @todo Remove this function once after all controller conversions are + // done. + return _aggregator_page_list($items, arg(1)); + } }