You are here

function date_timezone_element_process in Date 7

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

Create a timezone form element.

Parameters

array $element:

Return value

array the timezone form element

1 string reference to 'date_timezone_element_process'
_date_api_element_info in date_api/date_api_elements.inc
Implementation of hook_element_info().

File

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

Code

function date_timezone_element_process($element, $form_state, $form) {
  $element['#tree'] = TRUE;
  $element['timezone'] = array(
    '#type' => 'select',
    '#title' => theme('date_part_label_timezone', array(
      'part_type' => 'select',
      'element' => $element,
    )),
    '#default_value' => $element['#default_value'],
    '#options' => date_timezone_names($element['#required']),
    '#weight' => $element['#weight'],
    '#required' => $element['#required'],
    '#theme' => 'date_select_element',
    '#theme_wrappers' => array(
      'form_element',
    ),
  );
  if (isset($element['#element_validate'])) {
    array_push($element['#element_validate'], 'date_timezone_validate');
  }
  else {
    $element['#element_validate'] = array(
      'date_timezone_validate',
    );
  }

  // TODO This sometimes causes problems, do we need it?

  //$element['#attributes'] = array('class' => array('date-timezone clear-block'));
  return $element;
}