function BlockViewBuilder::lazyBuilder
Same name and namespace in other branches
- 9 core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::lazyBuilder()
- 8.9.x core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::lazyBuilder()
- 10 core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::lazyBuilder()
Render API callback: Builds a block that can be pre-rendered.
This function is assigned as a #lazy_builder callback.
Parameters
string $entity_id: A block config entity ID.
string $view_mode: The view mode the block is being viewed in.
Return value
array A render array with a #pre_render callback to render the block.
File
-
core/
modules/ block/ src/ BlockViewBuilder.php, line 170
Class
- BlockViewBuilder
- Provides a Block view builder.
Namespace
Drupal\blockCode
public static function lazyBuilder($entity_id, $view_mode) {
return static::buildPreRenderableBlock(Block::load($entity_id), \Drupal::service('module_handler'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.