core/lib/Drupal/Core/Template/TwigExtension.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index b311347..8c6abcc 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -466,6 +466,21 @@ public function escapeFilter(\Twig_Environment $env, $arg, $strategy = 'html', $ return $this->renderer->render($arg); } + /** + * Bubbles Twig template argument's cacheability & attachment metadata. + * + * For example: a generated link or generated URL object is passed as a Twig + * template argument, and its bubbleable metadata must be bubbled. + * + * @see \Drupal\Core\GeneratedLink + * @see \Drupal\Core\GeneratedUrl + * + * @param mixed $arg + * A Twig template argument that is about to be printed. + * + * @see \Drupal\Core\Theme\ThemeManager::render() + * @see \Drupal\Core\Render\RendererInterface::render() + */ protected function bubbleArgMetadata($arg) { if ($arg instanceof CacheableDependencyInterface || $arg instanceof AttachmentsInterface) { $arg_bubbleable = []; @@ -478,8 +493,7 @@ protected function bubbleArgMetadata($arg) { $arg_bubbleable['#attached'] = $arg->getAttachments(); } if ($arg_bubbleable) { - // @todo Inject the Renderer in https://www.drupal.org/node/2529438. - drupal_render($arg_bubbleable); + $this->renderer->render($arg_bubbleable); } } }