diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php index 5b9ba01..1791ede 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php @@ -13,6 +13,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Routing\PathBasedGeneratorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -52,6 +53,13 @@ class AggregatorController implements ControllerInterface { protected $moduleHandler; /** + * The url generator. + * + * @var \Drupal\Core\Routing\PathBasedGeneratorInterface + */ + protected $urlGenerator; + + /** * Constructs a \Drupal\aggregator\Routing\AggregatorController object. * * @param \Drupal\Core\Entity\EntityManager $entity_manager @@ -65,11 +73,12 @@ class AggregatorController implements ControllerInterface { * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, ModuleHandlerInterface $module_handler) { + public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator) { $this->entityManager = $entity_manager; $this->database = $database; $this->configFactory = $config_factory; $this->moduleHandler = $module_handler; + $this->urlGenerator = $url_generator; } /** @@ -80,7 +89,8 @@ public static function create(ContainerInterface $container) { $container->get('plugin.manager.entity'), $container->get('database'), $container->get('config.factory'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('url_generator') ); } @@ -125,7 +135,7 @@ public function feedRefresh(FeedInterface $aggregator_feed, Request $request) { // @todo after https://drupal.org/node/1972246 find a new place for it. aggregator_refresh($aggregator_feed); - return new RedirectResponse(url('admin/config/services/aggregator', array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath('admin/config/services/aggregator', array('absolute' => TRUE))); } /** @@ -176,7 +186,7 @@ public function adminOverview() { '#theme' => 'table', '#header' => $header, '#rows' => $rows, - '#empty' => t('No feeds available. Add feed.', array('@link' => url('admin/config/services/aggregator/add/feed'))), + '#empty' => 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'); @@ -205,7 +215,7 @@ public function adminOverview() { '#theme' => 'table', '#header' => $header, '#rows' => $rows, - '#empty' => t('No categories available. Add category.', array('@link' => url('admin/config/services/aggregator/add/category'))), + '#empty' => t('No categories available. Add category.', array('@link' => $this->urlGenerator->generateFromPath('admin/config/services/aggregator/add/category'))), ); return $build; @@ -236,7 +246,7 @@ public function categories() { $summary_items = $this->entityManager->getRenderController('aggregator_item')->viewMultiple($items, 'summary'); } } - $category->url = url('aggregator/categories/' . $category->cid); + $category->url = $this->urlGenerator->generateFromPath('aggregator/categories/' . $category->cid); $build[$category->cid] = array( '#theme' => 'aggregator_summary_items', '#summary_items' => $summary_items, @@ -298,7 +308,7 @@ public function sources() { ->viewMultiple($items, 'summary'); } } - $feed->url = url('aggregator/sources/' . $feed->id()); + $feed->url = $this->urlGenerator->generateFromPath('aggregator/sources/' . $feed->id()); $build[$feed->id()] = array( '#theme' => 'aggregator_summary_items', '#summary_items' => $summary_items,