function Block::execute

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/display/Block.php \Drupal\views\Plugin\views\display\Block::execute()
  2. 8.9.x core/modules/views/src/Plugin/views/display/Block.php \Drupal\views\Plugin\views\display\Block::execute()
  3. 10 core/modules/views/src/Plugin/views/display/Block.php \Drupal\views\Plugin\views\display\Block::execute()

The display block handler returns the structure necessary for a block.

Overrides DisplayPluginBase::execute

File

core/modules/views/src/Plugin/views/display/Block.php, line 130

Class

Block
The plugin that handles a block.

Namespace

Drupal\views\Plugin\views\display

Code

public function execute() {
    // Prior to this being called, the $view should already be set to this
    // display, and arguments should be set on the view.
    $element = $this->view
        ->render();
    if ($this->outputIsEmpty() && $this->getOption('block_hide_empty') && empty($this->view->style_plugin->definition['even empty'])) {
        return [];
    }
    else {
        return $element;
    }
}

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