diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php index 884251d..fc0a926 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php @@ -7,6 +7,7 @@ namespace Drupal\aggregator\Routing; +use Drupal\Core\Config\ConfigFactory; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\ControllerInterface; use Drupal\Core\Entity\EntityManager; @@ -24,20 +25,33 @@ class AggregatorController implements ControllerInterface { protected $entityManager; /** + * The config factory to get aggregator settings. + * + * @var \Drupal\Core\Config\ConfigFactory + */ + protected $configFactory; + + /** * Constructs a \Drupal\aggregator\Routing\AggregatorController object. * * @param \Drupal\Core\Entity\EntityManager $entity_manager * The Entity manager. + * @param \Drupal\Core\Config\ConfigFactory $config_factory + * The config factory. */ - public function __construct(EntityManager $entity_manager) { + public function __construct(EntityManager $entity_manager, ConfigFactory $config_factory) { $this->entityManager = $entity_manager; + $this->configFactory = $config_factory; } /** * {inheritdoc} */ public static function create(ContainerInterface $container) { - return new static($container->get('plugin.manager.entity')); + return new static( + $container->get('plugin.manager.entity'), + $container->get('config.factory') + ); } /** @@ -63,7 +77,8 @@ public function feedAdd() { * An HTML-formatted string. */ public function sources() { - $feeds = entity_load_multiple('aggregator_feed'); + + $feeds = $this->entityManager->getStorageController('aggregator_feed')->load(); // TODO move included functions to controller. module_load_include('inc', 'aggregator', 'aggregator.pages'); @@ -76,10 +91,14 @@ public function sources() { foreach ($feeds as $feed) { // Most recent items: $summary_items = array(); - $aggregator_summary_items = config('aggregator.settings')->get('source.list_max'); + $aggregator_summary_items = $this->configFactory + ->get('aggregator.settings') + ->get('source.list_max'); if ($aggregator_summary_items) { if ($items = aggregator_load_feed_items('source', $feed, $aggregator_summary_items)) { - $summary_items = entity_view_multiple($items, 'summary'); + $summary_items = $this->entityManager + ->getRenderController('aggregator_item') + ->viewMultiple($items, 'summary'); } } $feed->url = url('aggregator/sources/' . $feed->id()); @@ -96,4 +115,5 @@ public function sources() { ); return $build; } + }