1 entity.api.php hook_entity_load($entities, $type)

Act on entities when loaded.

This is a generic load hook called for all entity types loaded via the entity API.

Parameters

$entities: The entities keyed by entity ID.

$type: The type of entities being loaded (i.e. node, user, comment).

Related topics

File

core/modules/entity/entity.api.php, line 220
Hooks provided by the Entity module.

Code

function hook_entity_load($entities, $type) {
  foreach ($entities as $entity) {
    $entity->foo = my_module_add_something($entity, $type);
  }
}