You are here

public function Page::optionsSummary in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::optionsSummary()

Provides the default summary for options in the views UI.

This output is returned as an array.

Overrides PathPluginBase::optionsSummary

File

core/modules/views/src/Plugin/views/display/Page.php, line 216

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
  parent::optionsSummary($categories, $options);
  $menu = $this
    ->getOption('menu');
  if (!is_array($menu)) {
    $menu = [
      'type' => 'none',
    ];
  }
  switch ($menu['type']) {
    case 'none':
    default:
      $menu_str = $this
        ->t('No menu');
      break;
    case 'normal':
      $menu_str = $this
        ->t('Normal: @title', [
        '@title' => $menu['title'],
      ]);
      break;
    case 'tab':
    case 'default tab':
      $menu_str = $this
        ->t('Tab: @title', [
        '@title' => $menu['title'],
      ]);
      break;
  }
  $options['menu'] = [
    'category' => 'page',
    'title' => $this
      ->t('Menu'),
    'value' => views_ui_truncate($menu_str, 24),
  ];

  // This adds a 'Settings' link to the style_options setting if the style
  // has options.
  if ($menu['type'] == 'default tab') {
    $options['menu']['setting'] = $this
      ->t('Parent menu link');
    $options['menu']['links']['tab_options'] = $this
      ->t('Change settings for the parent menu');
  }
}