public function Renderer::addCacheableDependency in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::addCacheableDependency()
- 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\RenderCode
public function addCacheableDependency(array &$elements, $dependency) {
$meta_a = CacheableMetadata::createFromRenderArray($elements);
$meta_b = CacheableMetadata::createFromObject($dependency);
$meta_a
->merge($meta_b)
->applyTo($elements);
}