public function PlaceholderingRenderCache::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::get()
Gets the cached, pre-rendered element of a renderable element from cache.
Parameters
array $elements: A renderable array.
Return value
array|false A renderable array, with the original element and all its children pre- rendered, or FALSE if no cached copy of the element is available.
Overrides RenderCache::get
See also
\Drupal\Core\Render\RendererInterface::render()
::set()
File
- core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php, line 99 - Contains \Drupal\Core\Render\PlaceholderingRenderCache.
Class
- PlaceholderingRenderCache
- Adds automatic placeholdering to the RenderCache.
Namespace
Drupal\Core\RenderCode
public function get(array $elements) {
// When rendering placeholders, special case auto-placeholdered elements:
// avoid retrieving them from cache again, or rendering them again.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === FALSE) {
$cached_placeholder_result = $this
->getFromPlaceholderResultsCache($elements);
if ($cached_placeholder_result !== FALSE) {
return $cached_placeholder_result;
}
}
$cached_element = parent::get($elements);
if ($cached_element === FALSE) {
return FALSE;
}
else {
if ($this->placeholderGenerator
->canCreatePlaceholder($elements) && $this->placeholderGenerator
->shouldAutomaticallyPlaceholder($cached_element)) {
return $this
->createPlaceholderAndRemember($cached_element, $elements);
}
return $cached_element;
}
}