function date_field_field_load in Date 8
Implements hook_field_load().
File
- date_field/
date_field.module, line 108
Code
function date_field_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
$timezone_db = date_get_timezone_db($field['settings']['tz_handling']);
$db_format = date_type_format($field['type']);
$keys = date_available_values($field);
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => &$item) {
// If the file does not exist, mark the entire item as empty.
if (is_array($item)) {
$item['data'] = isset($item['data']) ? unserialize($item['data']) : array();
$item['timezone_db'] = $timezone_db;
$item['date_type'] = $field['type'];
if (!empty($field['settings']['cache_enabled']) && ($delta < $field['settings']['cache_count'] || $field['settings']['cache_count'] == 0)) {
foreach ($keys as $key) {
if (!empty($item[$key])) {
$item['db'][$key] = $date;
}
}
}
}
}
}
}