protected function BaseController::renderRecursive in Render cache 7.2
Renders uncached objects in a recursion compatible way.
The default implementation is dumb and expensive performance wise, as it calls the render() method for each object seperately.
Controllers that support recursions should implement the RecursionControllerInterface and subclass from BaseRecursionController.
Parameters
object[] $objects: Array of $objects to be rendered keyed by id.
Return value
array[] Render array keyed by id.
Overrides AbstractBaseController::renderRecursive
See also
\Drupal\render_cache\RenderCache\Controller\RecursionControllerInterface
\Drupal\render_cache\RenderCache\Controller\BaseRecursionController
1 call to BaseController::renderRecursive()
- BaseController::view in src/
RenderCache/ Controller/ BaseController.php
1 method overrides BaseController::renderRecursive()
- BaseRecursionController::renderRecursive in src/
RenderCache/ Controller/ BaseRecursionController.php - Renders uncached objects in a recursion compatible way.
File
- src/
RenderCache/ Controller/ BaseController.php, line 463 - Contains \Drupal\render_cache\RenderCache\Controller\BaseController
Class
- BaseController
- Base class for Controller plugin objects.
Namespace
Drupal\render_cache\RenderCache\ControllerCode
protected function renderRecursive(array $objects) {
$build = array();
foreach ($objects as $id => $object) {
$single_objects = array(
$id => $object,
);
$this->renderStack
->increaseRecursion();
$render = $this
->render($single_objects);
$storage = $this->renderStack
->decreaseRecursion();
if (!empty($render[$id])) {
$build[$id] = $render[$id];
$build[$id]['x_render_cache_recursion_storage'] = $storage;
}
}
return $build;
}