You are here

function views_plugin_display_page_db::options_validate in Dynamic Background 7.2

Same name and namespace in other branches
  1. 6 modules/dynamic_background_views/views/plugins/views_plugin_display_page_db.inc \views_plugin_display_page_db::options_validate()
  2. 7 modules/dynamic_background_views/views/plugins/views_plugin_display_page_db.inc \views_plugin_display_page_db::options_validate()

Provide the validation of the default form for setting options.

Overrides views_plugin_display_page::options_validate

File

modules/dynamic_background_views/views/plugins/views_plugin_display_page_db.inc, line 69
Contains the dynamic background views page display plugin, which is an extension of the std. view page display.

Class

views_plugin_display_page_db
The plugin that handles a full page.

Code

function options_validate(&$form, &$form_state) {

  // It is very important to call the parent function here.
  parent::options_validate($form, $form_state);

  // Check that only one image have been selected.
  switch ($form_state['section']) {
    case 'dynamic_background':
      $no_of_images = 0;
      foreach ($form_state['values']['dynamic_background'] as $key => $value) {
        if ($value['selected']) {
          $no_of_images++;
          if ($no_of_images > 1) {
            form_error($form['dynamic_background'][$key], t('You should only select one image.'));
          }
        }
      }
      break;
  }
}