function PlaceholderingRenderCache::createPlaceholderAndRemember
Same name in other branches
- 9 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::createPlaceholderAndRemember()
- 8.9.x core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::createPlaceholderAndRemember()
- 10 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::createPlaceholderAndRemember()
Create a placeholder for a renderable array and remember in a static cache.
Parameters
array $rendered_elements: A fully rendered renderable array.
array $pre_bubbling_elements: A renderable array corresponding to the state (in particular, the cacheability metadata) of $rendered_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
array Renderable array with placeholder markup and the attached placeholder replacement metadata.
3 calls to PlaceholderingRenderCache::createPlaceholderAndRemember()
- PlaceholderingRenderCache::get in core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php - Gets the cached, pre-rendered element of a renderable element from cache.
- PlaceholderingRenderCache::set in core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php - Caches the rendered output of a renderable array.
- TestPlaceholderingRenderCache::createPlaceholderAndRemember in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererPlaceholdersTest.php - Create a placeholder for a renderable array and remember in a static cache.
1 method overrides PlaceholderingRenderCache::createPlaceholderAndRemember()
- TestPlaceholderingRenderCache::createPlaceholderAndRemember in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererPlaceholdersTest.php - Create a placeholder for a renderable array and remember in a static cache.
File
-
core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php, line 156
Class
- PlaceholderingRenderCache
- Adds automatic placeholdering to the RenderCache.
Namespace
Drupal\Core\RenderCode
protected function createPlaceholderAndRemember(array $rendered_elements, array $pre_bubbling_elements) {
$placeholder_element = $this->placeholderGenerator
->createPlaceholder($pre_bubbling_elements);
// Remember the result for this placeholder to avoid double work.
$placeholder = (string) $placeholder_element['#markup'];
$this->placeholderResultsCache[$placeholder] = $rendered_elements;
return $placeholder_element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.