function field_entity_uuid_presave in Universally Unique IDentifier 7
Implements hook_entity_uuid_presave().
Related topics
File
- ./
uuid.core.inc, line 290 - Implementation of UUID hooks for all core modules.
Code
function field_entity_uuid_presave(&$entity, $entity_type) {
list(, , $bundle_name) = entity_extract_ids($entity_type, $entity);
$instances = field_info_instances($entity_type, $bundle_name);
foreach ($instances as $field_name => $instance) {
$field = field_info_field($field_name);
if (!empty($field) && isset($entity->{$field_name})) {
foreach ($entity->{$field_name} as $langcode => &$items) {
// Invoke 'hook_field_uuid_load'. We can't use module_invoke() since
// that is not passing by reference.
$function = $field['module'] . '_field_uuid_presave';
if (function_exists($function)) {
$function($entity_type, $entity, $field, $instance, $langcode, $items);
}
}
}
}
}