function hook_entity_load

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

modules/system/system.api.php, line 302
Hooks provided by Drupal core and the System module.

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_entity_load/7.x