You are here

function date_views_argument_handler::options_validate in Date 8

Same name and namespace in other branches
  1. 7.3 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::options_validate()
  2. 7 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::options_validate()
  3. 7.2 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::options_validate()

Overrides date_views_argument_handler_simple::options_validate

File

date_views/includes/date_views_argument_handler.inc, line 73
Date API views argument handler. This argument combines multiple date arguments into a single argument where all fields are controlled by the same date and can be combined with either AND or OR.

Class

date_views_argument_handler
Date API argument handler.

Code

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

  // Views will whine if we don't have something for the these values even though we removed the option for summaries.
  $form_state['values']['options']['summary']['format'] = 'none';
  $form_state['values']['options']['summary']['options']['none'] = array();

  // It is very important to call the parent function here:
  parent::options_validate($form, $form_state);
  if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {
    $check_fields = array_filter($form_state['values']['options']['date_fields']);
    if (empty($check_fields)) {
      form_error($form['date_fields'], t('You must select at least one date field for this argument.'));
    }
  }
}