You are here

public function Block::preBlockBuild in Drupal 9

Same name and namespace in other branches
  1. 8 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 364

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']);
  }
}