function PlaceholderingRenderCache::set
Same name in other branches
- 9 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::set()
- 10 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::set()
- 11.x core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::set()
Overrides RenderCache::set
File
-
core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php, line 126
Class
- PlaceholderingRenderCache
- Adds automatic placeholdering to the RenderCache.
Namespace
Drupal\Core\RenderCode
public function set(array &$elements, array $pre_bubbling_elements) {
$result = parent::set($elements, $pre_bubbling_elements);
// @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack
->getCurrentRequest()
->isMethodCacheable()) {
return FALSE;
}
if ($this->placeholderGenerator
->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator
->shouldAutomaticallyPlaceholder($elements)) {
// Overwrite $elements with a placeholder. The Renderer (which called this
// method) will update the context with the bubbleable metadata of the
// overwritten $elements.
$elements = $this->createPlaceholderAndRemember($this->getCacheableRenderArray($elements), $pre_bubbling_elements);
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.