function Block::preBlockBuild

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

Allows to change the display settings right before executing the block.

Parameters

\Drupal\views\Plugin\Block\ViewsBlock $block: The block plugin for views displays.

File

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

Class

Block
The plugin that handles a block.

Namespace

Drupal\views\Plugin\views\display

Code

public function preBlockBuild(ViewsBlock $block) {
    $config = $block->getConfiguration();
    if ($config['items_per_page'] !== 'none') {
        $this->view
            ->setItemsPerPage($config['items_per_page']);
    }
}

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