You are here

function date_browser_validate in Date 5

Same name and namespace in other branches
  1. 5.2 date/date_views.inc \date_browser_validate()

Validate a view.

1 string reference to 'date_browser_validate'
_date_views_style_plugins in ./date_views.inc
Implementation of hook_views_style_plugins()

File

./date_views.inc, line 585

Code

function date_browser_validate($type, $view, $form) {

  // list (and table) modes require there to be at least 1 field active.
  if (is_array($view['field'])) {
    $fields = array_filter(array_keys($view['field']), 'is_numeric');
  }
  if (!$fields) {
    form_error($form["{$type}-info"][$type . '_type'], t('The Date Browser requires at least one field.'));
  }

  // Make sure all arguments are set to 'Display all values'.
  foreach ($view['argument'] as $delta => $argument) {
    if (is_numeric($delta) && $argument['argdefault'] != 2) {
      form_error($form['argument'][$delta]['argdefault'], t('Date Browser arguments must be set to \'Display All Values\'.'));
    }
  }
}