public function PlaceholderingRenderCache::set in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::set()
Caches the rendered output of a renderable array.
May be called by an implementation of \Drupal\Core\Render\RendererInterface while rendering, if the #cache property is set.
Parameters
array $elements: A renderable array.
array $pre_bubbling_elements: A renderable array corresponding to the state (in particular, the cacheability metadata) of $elements prior to the beginning of its rendering process, and therefore before any bubbling of child information has taken place. Only the #cache property is used by this function, so the caller may omit all other properties and children from this array.
Return value
bool|null Returns FALSE if no cache item could be created, NULL otherwise.
Overrides RenderCache::set
See also
::get()
File
- core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php, line 126 - Contains \Drupal\Core\Render\PlaceholderingRenderCache.
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);
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;
}