function tzfield_field_validate in Time Zone Field 7
Implements hook_field_validate().
File
- ./
tzfield.module, line 57 - Defines a time zone field type.
Code
function tzfield_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
$options = tzfield_options_list($field);
foreach ($items as $delta => $item) {
if (!empty($item['value']) && !isset($options[$item['value']])) {
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'tzfield_illegal_value',
'message' => t('%name: This time zone is not valid.', array(
'%name' => $instance['label'],
)),
);
}
}
return $items;
}