function tzfield_field_formatter_view in Time Zone Field 7
Implements hook_field_formatter_view().
File
- ./
tzfield.module, line 198 - Defines a time zone field type.
Code
function tzfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
switch ($display['type']) {
case 'tzfield_default':
foreach ($items as $delta => $item) {
// Time zones should not contain any characters that require HTML
// encoding.
$element[$delta] = array(
'#markup' => $item['value'],
);
}
break;
case 'tzfield_date':
foreach ($items as $delta => $item) {
// If the date format string contains a character that requires HTML
// encoding, then for plain text output from this formatter, you will
// need to HTML decode it.
$element[$delta]['#markup'] = $item['value'] ? check_plain(format_date(REQUEST_TIME, 'custom', $display['settings']['format'], $item['value'])) : '';
}
break;
}
return $element;
}