function field_timer_field_load in Field Timer 7.2
Same name and namespace in other branches
- 7 field_timer.module \field_timer_field_load()
Implements hook_field_load().
File
- ./
field_timer.module, line 198 - Main module file.
Code
function field_timer_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
// Set timestamp for field item if an entity property used as target/end date.
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => $item) {
if (empty($item['timestamp']) && !empty($item['entity_property_name']) && isset($entity->{$item['entity_property_name']})) {
$items[$id][$delta]['timestamp'] = $entity->{$item['entity_property_name']};
}
}
}
}