function BlockViewBuilder::view

Same name in other branches
  1. 9 core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::view()
  2. 8.9.x core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::view()
  3. 11.x core/modules/block/src/BlockViewBuilder.php \Drupal\block\BlockViewBuilder::view()

Overrides EntityViewBuilder::view

File

core/modules/block/src/BlockViewBuilder.php, line 31

Class

BlockViewBuilder
Provides a Block view builder.

Namespace

Drupal\block

Code

public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    $build = $this->viewMultiple([
        $entity,
    ], $view_mode, $langcode);
    return reset($build);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.