You are here

public function Renderer::addCacheableDependency in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::addCacheableDependency()
  2. 9 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::addCacheableDependency()

File

core/lib/Drupal/Core/Render/Renderer.php, line 674

Class

Renderer
Turns a render array into an HTML string.

Namespace

Drupal\Core\Render

Code

public function addCacheableDependency(array &$elements, $dependency) {
  $meta_a = CacheableMetadata::createFromRenderArray($elements);
  $meta_b = CacheableMetadata::createFromObject($dependency);
  $meta_a
    ->merge($meta_b)
    ->applyTo($elements);
}