function EntityViewBuilder::setRecursiveRenderProtection
Entity render array #pre_render callback.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityViewBuilder.php, line 558
Class
- EntityViewBuilder
- Base class for entity view builders.
Namespace
Drupal\Core\EntityCode
public function setRecursiveRenderProtection(array $build) : array {
// Checks whether entity render array with matching cache keys is being
// recursively rendered. If not already being rendered,
// add an entry to track that it is.
$recursion_key = $this->getRenderRecursionKey($build);
if (isset(static::$recursionKeys[$recursion_key])) {
trigger_error(sprintf('Recursive rendering attempt aborted for %s. In progress: %s', $recursion_key, print_r(static::$recursionKeys, TRUE)), E_USER_WARNING);
$build['#printed'] = TRUE;
}
else {
static::$recursionKeys[$recursion_key] = TRUE;
}
return $build;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.