1 date.elements.inc date_year_range_element_value_callback($element, $input = FALSE, &$form_state = array())

Element value callback for the date_year_range form element.

File

core/modules/date/date.elements.inc, line 222
Date forms and form themes and validation.

Code

function date_year_range_element_value_callback($element, $input = FALSE, &$form_state = array()) {
  // Convert the element's default value from a string to an array (to match
  // what we will get from the two textfields when the form is submitted).
  if ($input === FALSE) {
    list($years_back, $years_forward) = explode(':', $element['#default_value']);
    return array(
      'years_back' => $years_back,
      'years_forward' => $years_forward,
    );
  }
  return NULL;
}