You are here

function date_entity_metadata_field_getter in Date 7.3

Same name and namespace in other branches
  1. 7 date.module \date_entity_metadata_field_getter()
  2. 7.2 date.module \date_entity_metadata_field_getter()

Getter callback to return date values as datestamp in UTC from the field.

1 string reference to 'date_entity_metadata_field_getter'
date_entity_metadata_property_info_alter in ./date.module
Callback to alter the property info of date fields.

File

./date.module, line 659

Code

function date_entity_metadata_field_getter($entity, array $options, $name, $entity_type, &$context) {
  $return = entity_metadata_field_verbatim_get($entity, $options, $name, $entity_type, $context);
  $items = $context['field']['cardinality'] == 1 ? array(
    $return,
  ) : $return;
  foreach ($items as $key => $item) {
    $items[$key] = date_entity_metadata_struct_getter($item, $options, 'value', 'struct', $context);
  }
  return $context['field']['cardinality'] == 1 ? $items[0] : $items;
}