You are here

function _datex_popup_authored_element_validate in Datex 7.3

From date_popup_authored.

1 string reference to '_datex_popup_authored_element_validate'
_datex_popup_authored_element_after_build in datex_popup/form.inc
From date_popup_authored.

File

datex_popup/form.inc, line 71
Alter date_popup element in various forms.

Code

function _datex_popup_authored_element_validate($element, &$form_state) {
  if (date_hidden_element($element) || is_string($element['#value'])) {
    return;
  }

  // If an error occurred in the validation of the date popup field the date
  // cannot be correctly rendered as a string. In this case clear the date value
  // to avoid subsequent errors when the node is validated.
  // @see date_popup_validate()
  // @see node_validate()
  $input_exists = NULL;
  $input = drupal_array_get_nested_value($form_state['values'], $element['#parents'], $input_exists);
  $date = date_popup_input_date($element, $input);
  if (is_object($date) && !empty($date->errors)) {
    $form_state['values']['date'] = NULL;
  }
}