You are here

function date_year_range_element_value_callback in Date 8

Same name and namespace in other branches
  1. 7.3 date_api/date_api_elements.inc \date_year_range_element_value_callback()
  2. 7.2 date_api/date_api_elements.inc \date_year_range_element_value_callback()

Element value callback for the date_year_range form element.

1 string reference to 'date_year_range_element_value_callback'
_date_api_element_info in date_api/date_api_elements.inc
Implements hook_element_info().

File

date_api/date_api_elements.inc, line 144
Date API elements themes and validation. This file is only included during the edit process to reduce memory usage.

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,
    );
  }
}