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

Breadcrumb

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

function 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 147

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' => Unicode::truncate($block_description, 24, FALSE, TRUE),
    ];
    $options['block_category'] = [
        'category' => 'block',
        'title' => $this->t('Block category'),
        'value' => Unicode::truncate($block_category, 24, FALSE, TRUE),
    ];
    $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'),
    ];
}

API Navigation

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