diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 8919e96..b5124bd 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -189,8 +189,7 @@ function aggregator_menu() { 'file' => 'aggregator.admin.inc', ); $items['aggregator/sources/%aggregator_feed'] = array( - 'title callback' => '_aggregator_page_label', - 'title arguments' => array(2), + 'title' => 'View', 'route_name' => 'aggregator_page_source', ); $items['aggregator/sources/%aggregator_feed/view'] = array( @@ -237,26 +236,6 @@ function aggregator_menu() { } /** - * Title callback: Returns a title for Aggregator feed view pages. - * - * @param \Drupal\aggregator\FeedInterface $feed - * Aggregator Feed to get a label. - * @param string $langcode - * (optional) The language code of the language that should be used for - * getting the label. If set to NULL, the entity's default language is - * used. - * - * @return string - * The label of the Aggregator Feed, or NULL if there is no label - * defined. - * - * @see aggregator_menu() - */ -function _aggregator_page_label($feed, $langcode = NULL) { - return $feed->label($langcode); -} - -/** * Title callback: Returns a title for aggregator category pages. * * @param $category diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc index c524505..30233e6 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -20,6 +20,7 @@ * @see aggregator_menu() */ function aggregator_page_source(Feed $feed) { + drupal_set_title($feed->label()); $feed_source = entity_view($feed, 'default'); // It is safe to include the fid in the query because it's loaded from the diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php index 41acd56..3519752 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php @@ -48,13 +48,6 @@ class AggregatorController implements ControllerInterface { protected $database; /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** * The url generator. * * @var \Drupal\Core\Routing\PathBasedGeneratorInterface @@ -72,14 +65,11 @@ class AggregatorController implements ControllerInterface { * The database connection. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. */ - public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator) { + public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, PathBasedGeneratorInterface $url_generator) { $this->entityManager = $entity_manager; $this->database = $database; $this->configFactory = $config_factory; - $this->moduleHandler = $module_handler; $this->urlGenerator = $url_generator; } @@ -91,7 +81,6 @@ public static function create(ContainerInterface $container) { $container->get('plugin.manager.entity'), $container->get('database'), $container->get('config.factory'), - $container->get('module_handler'), $container->get('url_generator') ); } @@ -121,7 +110,8 @@ public function feedAdd() { * @return string * The rendered list of items for the feed. */ - public function viewFeed(FeedInterface $aggregator_feed = NULL) { + public function viewFeed(FeedInterface $aggregator_feed) { + drupal_set_title($aggregator_feed->label()); $feed_source = $this->entityManager->getRenderController($aggregator_feed->entityType()) ->view($aggregator_feed, 'default'); // Load aggregator feed item for the particular feed id. @@ -277,9 +267,6 @@ public function adminOverview() { * A render array. */ public function categories() { - // @todo Refactor this once all controller conversions are complete. - $this->moduleHandler->loadInclude('aggregator', 'inc', 'aggregator.pages'); - $result = $this->database->query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {aggregator_item} i ON ci.iid = i.iid GROUP BY c.cid, c.title, c.description'); $build = array( @@ -291,7 +278,10 @@ public function categories() { foreach ($result as $category) { $summary_items = array(); if ($aggregator_summary_items) { - if ($items = aggregator_load_feed_items('category', $category, $aggregator_summary_items)) { + $items = $this->entityManager + ->getStorageController('aggregator_item') + ->loadFeedItems('category', $category, $aggregator_summary_items); + if ($items) { $summary_items = $this->entityManager->getRenderController('aggregator_item')->viewMultiple($items, 'summary'); } } @@ -314,14 +304,10 @@ public function categories() { public function pageLast() { drupal_add_feed('aggregator/rss', $this->configFactory->get('system.site')->get('name') . ' ' . t('aggregator')); - // @todo Refactor this function once after all controller conversions are - // done. - $this->moduleHandler->loadInclude('aggregator', 'inc', 'aggregator.pages'); - $items = aggregator_load_feed_items('sum'); - - // @todo Refactor this function once after all controller conversions are - // done. - return _aggregator_page_list($items, arg(1)); + $items = $this->entityManager + ->getStorageController('aggregator_item') + ->loadFeedItems('sum'); + return $this->buildPageList($items); } /** @@ -340,10 +326,6 @@ public function sources() { '#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(); @@ -351,7 +333,10 @@ public function sources() { ->get('aggregator.settings') ->get('source.list_max'); if ($aggregator_summary_items) { - if ($items = aggregator_load_feed_items('source', $feed, $aggregator_summary_items)) { + $items = $this->entityManager + ->getStorageController('aggregator_item') + ->loadFeedItems('source', $feed, $aggregator_summary_items); + if ($items) { $summary_items = $this->entityManager ->getRenderController('aggregator_item') ->viewMultiple($items, 'summary');