function Page::validate

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

Overrides PathPluginBase::validate

File

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

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public function validate() {
  $errors = parent::validate();
  $menu = $this->getOption('menu');
  if (!empty($menu['type']) && $menu['type'] != 'none' && empty($menu['title'])) {
    $errors[] = $this->t('Display @display is set to use a menu but the menu link text is not set.', [
      '@display' => $this->display['display_title'],
    ]);
  }
  if ($menu['type'] == 'default tab') {
    $tab_options = $this->getOption('tab_options');
    if (!empty($tab_options['type']) && $tab_options['type'] != 'none' && empty($tab_options['title'])) {
      $errors[] = $this->t('Display @display is set to use a parent menu but the parent menu link text is not set.', [
        '@display' => $this->display['display_title'],
      ]);
    }
  }
  return $errors;
}

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