You are here

function date_timezone_site_form_after_build in Date 6.2

Hide the original form.

We have to do this in after_build in case the Event module is enabled since the Event module will do its form_alter() after the Date module.

1 string reference to 'date_timezone_site_form_after_build'
date_timezone_form_alter in date_timezone/date_timezone.module
Implementation of hook_form_alter().

File

date_timezone/date_timezone.module, line 85
This module will make the alter the user and site timezone forms to select a timezone name instead of a timezone offset.

Code

function date_timezone_site_form_after_build(&$form) {

  // Set the value, and make sure it's a legal value.
  $value = $form['locale']['date_default_timezone']['#default_value'];
  $options = $form['locale']['date_default_timezone']['#options'];
  if (!array_key_exists($value, $options)) {

    //$value = array_pop($options);
    $value = NULL;
  }
  $form['locale']['date_default_timezone']['#type'] = 'hidden';
  $form['locale']['date_default_timezone']['#value'] = $value;
  return $form;
}