You are here

function field_entity_uuid_load in Universally Unique IDentifier 7

Implements hook_entity_uuid_load().

Related topics

File

./uuid.core.inc, line 266
Implementation of UUID hooks for all core modules.

Code

function field_entity_uuid_load(&$entities, $entity_type) {
  foreach ($entities as $entity) {
    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_load';
          if (function_exists($function)) {
            $function($entity_type, $entity, $field, $instance, $langcode, $items);
          }
        }
      }
    }
  }
}