public function Page::validateOptionsForm

Overrides \Drupal\views\Plugin\views\display\callbackPluginBase::validateOptionsForm().

Overrides PathPluginBase::validateOptionsForm

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Page.php, line 372
Contains \Drupal\views\Plugin\views\display\Page.

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public function validateOptionsForm(&$form, &$form_state) {
  parent::validateOptionsForm($form, $form_state);
  if ($form_state['section'] == 'menu') {
    $path = $this
      ->getOption('path');
    if ($form_state['values']['menu']['type'] == 'normal' && strpos($path, '%') !== FALSE) {
      form_error($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.'));
    }
    if ($form_state['values']['menu']['type'] == 'default tab' || $form_state['values']['menu']['type'] == 'tab') {
      $bits = explode('/', $path);
      $last = array_pop($bits);
      if ($last == '%') {
        form_error($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.'));
      }
    }
    if ($form_state['values']['menu']['type'] != 'none' && empty($form_state['values']['menu']['title'])) {
      form_error($form['menu']['title'], t('Title is required for this menu type.'));
    }
  }
}