You are here

function tzfield_widget in Time Zone Field 6

Implementation of hook_widget().

File

./tzfield.module, line 222
Defines a field type for storing timezones.

Code

function tzfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
  switch ($field['widget']['type']) {
    case 'tzfield_select':
      $element = array(
        '#type' => 'tzfield_select',
        '#default_value' => $items,
      );
      break;
    case 'tzfield_autocomplete':
      $element = array(
        '#type' => 'tzfield_autocomplete',
        '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
      );
      break;
  }
  return $element;
}