diff --git a/core/modules/aggregator/src/Controller/AggregatorController.php b/core/modules/aggregator/src/Controller/AggregatorController.php index 303b43c..fbb14f1 100644 --- a/core/modules/aggregator/src/Controller/AggregatorController.php +++ b/core/modules/aggregator/src/Controller/AggregatorController.php @@ -51,7 +51,7 @@ public static function create(ContainerInterface $container) { * Presents the aggregator feed creation form. * * @return array - * A form array as expected by drupal_render(). + * A form array as expected by $renderer->render(). */ public function feedAdd() { $feed = $this->entityManager()->getStorage('aggregator_feed') @@ -111,7 +111,7 @@ public function feedRefresh(FeedInterface $aggregator_feed) { * Displays the aggregator administration page. * * @return array - * A render array as expected by drupal_render(). + * A render array as expected by $renderer->render(). */ public function adminOverview() { $entity_manager = $this->entityManager(); diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php index fcc2584..877399b 100644 --- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php +++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php @@ -15,6 +15,7 @@ use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -51,6 +52,13 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt protected $itemQuery; /** + * The renderer service. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + /** * Constructs an AggregatorFeedBlock object. * * @param array $configuration @@ -65,12 +73,15 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt * The entity storage for feed items. * @param \Drupal\Core\Entity\Query\QueryInterface $item_query * The entity query object for feed items. + * @param \Drupal\Core\Render\RendererInterface $renderer + * The renderer service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, FeedStorageInterface $feed_storage, ItemStorageInterface $item_storage, QueryInterface $item_query) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, FeedStorageInterface $feed_storage, ItemStorageInterface $item_storage, QueryInterface $item_query, RendererInterface $renderer) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->feedStorage = $feed_storage; $this->itemStorage = $item_storage; $this->itemQuery = $item_query; + $this->renderer = $renderer; } @@ -84,7 +95,8 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('entity.manager')->getStorage('aggregator_feed'), $container->get('entity.manager')->getStorage('aggregator_item'), - $container->get('entity.query')->get('aggregator_item') + $container->get('entity.query')->get('aggregator_item'), + $container->get('renderer') ); } @@ -161,7 +173,7 @@ public function build() { '#url' => $feed->urlInfo(), '#attributes' => array('title' => $this->t("View this feed's recent news.")), ); - $read_more = drupal_render($more_link); + $read_more = $this->renderer->render($more_link); $rendered_items = array(); foreach ($items as $item) { $aggregator_block_item = array( @@ -169,7 +181,7 @@ public function build() { '#url' => $item->urlInfo(), '#title' => $item->label(), ); - $rendered_items[] = drupal_render($aggregator_block_item); + $rendered_items[] = $this->renderer->render($aggregator_block_item); } // Only display the block if there are items to show. if (count($rendered_items) > 0) { @@ -178,7 +190,7 @@ public function build() { '#items' => $rendered_items, ); return array( - '#children' => drupal_render($item_list) . $read_more, + '#children' => $this->renderer->render($item_list) . $read_more, ); } } diff --git a/core/modules/aggregator/src/Plugin/views/row/Rss.php b/core/modules/aggregator/src/Plugin/views/row/Rss.php index 72410e5..d9075fb 100644 --- a/core/modules/aggregator/src/Plugin/views/row/Rss.php +++ b/core/modules/aggregator/src/Plugin/views/row/Rss.php @@ -79,7 +79,7 @@ public function render($row) { '#options' => $this->options, '#row' => $item, ); - return drupal_render_root($build); + return $this->renderer->renderRoot($build); } }