You are here

function tzfield_field_widget_options_select_form_alter in Time Zone Field 7

Implements hook_field_widget_options_select_form_alter().

File

./tzfield.module, line 132
Defines a time zone field type.

Code

function tzfield_field_widget_options_select_form_alter(&$element, &$form_state, $context) {
  if (!module_exists('timezone_picker') || $context['field']['type'] != 'tzfield') {
    return;
  }
  $element['#map_id'] = drupal_html_id('timezone-picker');
  $element['#suffix'] = theme('timezone_map', array(
    'map_id' => $element['#map_id'],
    'map_src' => file_create_url(drupal_get_path('module', 'timezone_picker') . '/images/map.png'),
  ));
  $element['#attached']['library'][] = array(
    'timezone_picker',
    'jquery.timezone-picker',
  );
  $element['#attached']['css'][] = drupal_get_path('module', 'timezone_picker') . '/timezone-picker.css';
  $element['#attached']['js'][] = drupal_get_path('module', 'timezone_picker') . '/timezone-picker.js';
  $element['#after_build'][] = 'tzfield_timezone_picker_after_build';
}