function views_plugin_display::options_validate

3.x views_plugin_display.inc views_plugin_display::options_validate(&$form, &$form_state)
2.x views_plugin_display.inc views_plugin_display::options_validate(&$form, &$form_state)

Validate the options form.

Overrides views_plugin::options_validate

1 call to views_plugin_display::options_validate()
1 method overrides views_plugin_display::options_validate()

File

plugins/views_plugin_display.inc, line 1477
Contains the base display plugin.

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function options_validate(&$form, &$form_state) {
  switch ($form_state['section']) {
    case 'display_title':
      if (empty($form_state['values']['display_title'])) {
        form_error($form['display_title'], t('Display title may not be empty.'));
      }
      break;
    case 'css_class':
      $css_class = $form_state['values']['css_class'];
      if (preg_match('/[^a-zA-Z0-9- ]/', $css_class)) {
        form_error($form['css_class'], t('CSS classes must be alphanumeric or dashes only.'));
      }
      break;
    case 'style_options':
      $style = TRUE;
    case 'row_options':
      // if row, $style will be empty.
      $plugin = $this->get_plugin(empty($style) ? 'row' : 'style');
      if ($plugin) {
        $plugin->options_validate($form[$form_state['section']], $form_state);
      }
      break;
    case 'access_options':
      $plugin = $this->get_access_plugin();
      if ($plugin) {
        $plugin->options_validate($form['access_options'], $form_state);
      }
      break;
    case 'cache_options':
      $plugin = $this->get_cache_plugin();
      if ($plugin) {
        $plugin->options_validate($form['cache_options'], $form_state);
      }
      break;
  }
}