function Block::optionsSummary

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

Provide the summary for page options in the views UI.

This output is returned as an array.

Overrides DisplayPluginBase::optionsSummary

File

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

Class

Block
The plugin that handles a block.

Namespace

Drupal\views\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories, $options);
    $categories['block'] = [
        'title' => $this->t('Block settings'),
        'column' => 'second',
        'build' => [
            '#weight' => -10,
        ],
    ];
    $block_description = strip_tags($this->getOption('block_description'));
    if (empty($block_description)) {
        $block_description = $this->t('None');
    }
    $block_category = $this->getOption('block_category');
    $options['block_description'] = [
        'category' => 'block',
        'title' => $this->t('Block name'),
        'value' => views_ui_truncate($block_description, 24),
    ];
    $options['block_category'] = [
        'category' => 'block',
        'title' => $this->t('Block category'),
        'value' => views_ui_truncate($block_category, 24),
    ];
    $filtered_allow = array_filter($this->getOption('allow'));
    $options['allow'] = [
        'category' => 'block',
        'title' => $this->t('Allow settings'),
        'value' => empty($filtered_allow) ? $this->t('None') : $this->t('Items per page'),
    ];
    $options['block_hide_empty'] = [
        'category' => 'other',
        'title' => $this->t('Hide block if the view output is empty'),
        'value' => $this->getOption('block_hide_empty') ? $this->t('Yes') : $this->t('No'),
    ];
}

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