protected TwigExtension::bubbleArgMetadata($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.
mixed $arg: A Twig template argument that is about to be printed.
\Drupal\Core\Theme\ThemeManager::render()
\Drupal\Core\Render\RendererInterface::render()
protected function bubbleArgMetadata($arg) { // If it's a renderable, then it'll be up to the generated render array it // returns to contain the necessary cacheability & attachment metadata. If // it doesn't implement CacheableDependencyInterface or AttachmentsInterface // then there is nothing to do here. if ($arg instanceof RenderableInterface || !($arg instanceof CacheableDependencyInterface || $arg instanceof AttachmentsInterface)) { return; } $arg_bubbleable = []; BubbleableMetadata::createFromObject($arg) ->applyTo($arg_bubbleable); $this->renderer->render($arg_bubbleable); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Template!TwigExtension.php/function/TwigExtension::bubbleArgMetadata/8.1.x