core/modules/forum/forum.module | 4 ++-- .../src/EventSubscriber/ThemeTestSubscriber.php | 15 +++++++++++++-- .../tests/modules/theme_test/theme_test.services.yml | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index eb25bf8..8ce12ba 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -61,12 +61,12 @@ function forum_help($route_name, RouteMatchInterface $route_match) { ); $container = array( '#theme' => 'container', - '#children' => drupal_render($more_help_link), + '#children' => $more_help_link, '#attributes' => array( 'class' => array('more-link'), ), ); - $output .= drupal_render($container); + $output .= \Drupal::service('renderer')->renderPlain($container); return $output; case 'forum.add_container': diff --git a/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php b/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php index d8f609a..86a0128 100644 --- a/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php +++ b/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php @@ -7,6 +7,7 @@ namespace Drupal\theme_test\EventSubscriber; +use Drupal\Core\Render\RendererInterface; use Drupal\Core\Url; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpKernel\KernelEvents; @@ -33,12 +34,22 @@ class ThemeTestSubscriber implements EventSubscriberInterface { protected $currentRouteMatch; /** + * The renderer. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + /** * Constructs a new ThemeTestSubscriber. * * @param \Drupal\Core\Routing\RouteMatchInterface $current_route_match + * @param \Drupal\Core\Render\RendererInterface $renderer + * The renderer. */ - public function __construct(RouteMatchInterface $current_route_match) { + public function __construct(RouteMatchInterface $current_route_match, RendererInterface $renderer) { $this->currentRouteMatch = $current_route_match; + $this->renderer = $renderer; } /** @@ -62,7 +73,7 @@ public function onRequest(GetResponseEvent $event) { '#url' => Url::fromRoute('user.page'), '#attributes' => array('title' => 'Themed output generated in a KernelEvents::REQUEST listener'), ); - $GLOBALS['theme_test_output'] = drupal_render($more_link); + $GLOBALS['theme_test_output'] = $this->renderer->renderPlain($more_link); } } diff --git a/core/modules/system/tests/modules/theme_test/theme_test.services.yml b/core/modules/system/tests/modules/theme_test/theme_test.services.yml index add8b4c..482c219 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.services.yml +++ b/core/modules/system/tests/modules/theme_test/theme_test.services.yml @@ -1,7 +1,7 @@ services: theme_test.subscriber: class: Drupal\theme_test\EventSubscriber\ThemeTestSubscriber - arguments: [@current_route_match] + arguments: [@current_route_match, @renderer] tags: - { name: event_subscriber }