function CachedStrategy::processNestedPlaceholders
Fetch any nested placeholders from cache.
Placeholders returned from cache may have placeholders in #attached, which can themselves be fetched from the cache. By recursively processing the placeholders here, we're able to use multiple cache get to fetch the cache items at each level of recursion.
1 call to CachedStrategy::processNestedPlaceholders()
- CachedStrategy::processPlaceholders in core/
lib/ Drupal/ Core/ Render/ Placeholder/ CachedStrategy.php - Processes placeholders to render them with different strategies.
File
-
core/
lib/ Drupal/ Core/ Render/ Placeholder/ CachedStrategy.php, line 40
Class
- CachedStrategy
- Looks up placeholders in the render cache and returns those we could find.
Namespace
Drupal\Core\Render\PlaceholderCode
private function processNestedPlaceholders(array $placeholders) : array {
$sets = [];
foreach ($placeholders as $key => $placeholder) {
if (!empty($placeholder['#attached']['placeholders'])) {
$sets[] = $placeholder['#attached']['placeholders'];
}
}
if ($sets) {
$cached = $this->renderCache
->getMultiple(...array_merge($sets));
if ($cached) {
$cached = $this->processNestedPlaceholders($cached);
foreach ($placeholders as $key => $placeholder) {
if (!empty($placeholder['#attached']['placeholders'])) {
$placeholders[$key]['#attached']['placeholders'] = array_replace($placeholder['#attached']['placeholders'], $cached);
}
}
}
}
return $placeholders;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.