You are here

function tzfield_form2data in Time Zone Field 6

Helper function to transpose the values returned by submitting the widget to the format to be stored in the field. Can be called anywhere this transformation is needed.

1 call to tzfield_form2data()
tzfield_validate in ./tzfield.module
FAPI function to validate tzfield element.

File

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

Code

function tzfield_form2data($element, $field) {
  $field_key = $element['#columns'][0];
  $items = (array) $element[$field_key]['#value'];
  $options = tzfield_options($field);
  $values = array_values($items);
  if (empty($values)) {
    $values[] = NULL;
  }
  $result = content_transpose_array_rows_cols(array(
    $field_key => $values,
  ));
  return $result;
}