public function RecursionControllerInterface::recursionStep in Render cache 7.2
Ensures that recursion storage is added to the right cached object.
Example: A module can implement hook_block_view_alter() and pass $block->content to ensure that recursion storage created during the building of the block is properly added to the block itself: {
?>
<?php}
function render_cache_block_block_view_alter(&$data, $block) {
if (!empty($block->render_cache_controller) && !empty($data['content'])) {
// Normalize to the drupal_render() structure so we can add something.
if (is_string($data['content'])) {
$data['content'] = array(
'#markup' => $data['#content'],
);
}
$block->render_cache_controller->recursionStep($data['content']);
}
}
{?><?php
}
Parameters
$build: The render array to add the recursion storage to when the $build is not empty.
1 method overrides RecursionControllerInterface::recursionStep()
- BaseRecursionController::recursionStep in src/
RenderCache/ Controller/ BaseRecursionController.php - Ensures that recursion storage is added to the right cached object.
File
- src/
RenderCache/ Controller/ RecursionControllerInterface.php, line 41 - Contains \Drupal\render_cache\RenderCache\Controller\RecursionControllerInterface
Class
- RecursionControllerInterface
- Interface to describe how RenderCache controller plugin objects supporting recursion are implemented.
Namespace
Drupal\render_cache\RenderCache\ControllerCode
public function recursionStep(array &$build);