Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Block.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal