diff --git c/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php w/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php index 700dde6..cd239b5 100644 --- c/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php +++ w/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php @@ -27,7 +27,7 @@ class AggregatorController extends ControllerBase implements ContainerInjectionI * * @var \Drupal\Core\Database\Connection; */ - protected $database; + protected $connection; /** * The category storage controller. @@ -39,13 +39,13 @@ class AggregatorController extends ControllerBase implements ContainerInjectionI /** * Constructs a \Drupal\aggregator\Controller\AggregatorController object. * - * @param \Drupal\Core\Database\Connection $database + * @param \Drupal\Core\Database\Connection $connection * The database connection. * @param \Drupal\aggregator\CategoryStorageControllerInterface $category_storage * The category storage service. */ - public function __construct(Connection $database, CategoryStorageControllerInterface $category_storage) { - $this->database = $database; + public function __construct(Connection $connection, CategoryStorageControllerInterface $category_storage) { + $this->connection = $connection; $this->categoryStorage = $category_storage; } @@ -85,13 +85,14 @@ public function feedAdd() { * The rendered list of items for the feed. */ public function viewFeed(FeedInterface $aggregator_feed) { - drupal_set_title($aggregator_feed->label()); $feed_source = $this->entityManager()->getRenderController('aggregator_feed') ->view($aggregator_feed, 'default'); // Load aggregator feed item for the particular feed id. $items = $this->entityManager()->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id()); // Print the feed items. - return $this->buildPageList($items, $feed_source); + $build = $this->buildPageList($items, $feed_source); + $build['#title'] = $aggregator_feed->label(); + return $build; } /** @@ -105,10 +106,10 @@ public function viewFeed(FeedInterface $aggregator_feed) { */ public function viewCategory($cid) { $category = $this->categoryStorage->load($cid); - drupal_set_title($category->title); $items = $this->entityManager()->getStorageController('aggregator_item')->loadByCategory($cid); - - return $this->buildPageList($items); + $build = $this->buildPageList($items); + $build['#title'] = $category->title; + return $build; } /** @@ -137,7 +138,6 @@ protected function buildPageList(array $items, $feed_source = '') { return $build; } - /** * Refreshes a feed, then redirects to the overview page. * @@ -173,7 +173,7 @@ public function feedRefresh(FeedInterface $aggregator_feed, Request $request) { * A render array as expected by drupal_render(). */ public function adminOverview() { - $result = $this->database->query('SELECT f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block ORDER BY f.title'); + $result = $this->connection->query('SELECT f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block ORDER BY f.title'); $header = array(t('Title'), $this->t('Items'), $this->t('Last update'), $this->t('Next update'), $this->t('Operations')); $rows = array(); @@ -217,7 +217,7 @@ public function adminOverview() { '#empty' => $this->t('No feeds available. Add feed.', array('@link' => $this->urlGenerator()->generateFromPath('admin/config/services/aggregator/add/feed'))), ); - $result = $this->database->query('SELECT c.cid, c.title, COUNT(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title'); + $result = $this->connection->query('SELECT c.cid, c.title, COUNT(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title'); $header = array(t('Title'), $this->t('Items'), $this->t('Operations')); $rows = array(); @@ -260,7 +260,7 @@ public function adminOverview() { * A render array. */ public function categories() { - $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'); + $result = $this->connection->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( '#type' => 'container',