You are here

function views_plugin_display_system::options_validate in Administration Views 7

Same name and namespace in other branches
  1. 6 plugins/views_plugin_display_system.inc \views_plugin_display_system::options_validate()

Overrides views_plugin_display::options_validate().

Overrides views_plugin_display::options_validate

File

plugins/views_plugin_display_system.inc, line 123
System display plugin.

Class

views_plugin_display_system
Plugin to handle replacement of existing system paths.

Code

function options_validate(&$form, &$form_state) {
  parent::options_validate($form, $form_state);
  switch ($form_state['section']) {
    case 'path':
      if (strpos($form_state['values']['path'], '$arg') !== FALSE) {
        form_error($form['path'], t('"$arg" is no longer supported. Use % instead.'));
      }
      if (strpos($form_state['values']['path'], '%') === 0) {
        form_error($form['path'], t('"%" may not be used for the first segment of a path.'));
      }

      // Automatically remove '/' from path.
      $form_state['values']['path'] = trim($form_state['values']['path'], '/');
      $system_view[$form_state['values']['path']] = array(
        $this->view->name => $this->view->current_display,
      );
      if (admin_views_duplicate_path($system_view)) {
        form_error($form['path'], t('Already used by another system view. Enter a different path.'));
      }
      break;
  }
}