You are here

public function Block::optionsSummary in Drupal 8

Same name and namespace in other branches
  1. 9 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()

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 152

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