hook_entity_load

  1. drupal
    1. 8 entity.api.php
    2. 7
Versions
8 – 7 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

Code

modules/system/system.api.php, line 281

<?php
function hook_entity_load($entities, $type) {
  foreach ($entities as $entity) {
    $entity->foo = mymodule_add_something($entity, $type);
  }
}
?>