1 date.module date_form_views_exposed_form_alter(&$form, &$form_state, $form_id)

Implements hook_form_FORM_ID_alter() for views_exposed_form().

File

core/modules/date/date.module, line 889
Defines date/time field types.

Code

function date_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  $children = element_children($form);
  foreach ($children as $child) {
    if (isset($form[$child]['#id']) && strpos($form[$child]['#id'], 'date_views_exposed_filter-') === 0) {
      // Remove empty or scalar date input when an array was expected.
      if (empty($form_state['input'][$child]) || !is_array($form_state['input'][$child])) {
        unset($form_state['input'][$child]);
      }
      elseif (empty($form_state['input'][$child]['value']) || !is_array($form_state['input'][$child]['value'])) {
        unset($form_state['input'][$child]['value']);
      }
    }
  }
}