You are here

function views_plugin_display::options_validate in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_display.inc \views_plugin_display::options_validate()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::options_validate()

Validate the options form.

Overrides views_plugin::options_validate

1 call to views_plugin_display::options_validate()
views_plugin_display_page::options_validate in plugins/views_plugin_display_page.inc
Validate the options form.
1 method overrides views_plugin_display::options_validate()
views_plugin_display_page::options_validate in plugins/views_plugin_display_page.inc
Validate the options form.

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;
  }
}