function Page::optionsSummary

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

Overrides PathPluginBase::optionsSummary

File

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

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' => Unicode::truncate($menu_str, 24, FALSE, TRUE),
    ];
    // 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');
    }
    // If the display path starts with 'admin/' the page will be rendered with
    // the Administration theme regardless of the 'use_admin_theme' option
    // therefore, we need to set the summary message to reflect this.
    if (str_starts_with($this->getOption('path') ?? '', 'admin/')) {
        $admin_theme_text = $this->t('Yes (admin path)');
    }
    elseif ($this->getOption('use_admin_theme')) {
        $admin_theme_text = $this->t('Yes');
    }
    else {
        $admin_theme_text = $this->t('No');
    }
    $options['use_admin_theme'] = [
        'category' => 'page',
        'title' => $this->t('Administration theme'),
        'value' => $admin_theme_text,
        'desc' => $this->t('Use the administration theme when rendering this display.'),
    ];
}

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