function hook_ENTITY_TYPE_load

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_ENTITY_TYPE_load()
  2. 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_ENTITY_TYPE_load()
  3. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_ENTITY_TYPE_load()

Act on entities of a specific type when loaded.

Parameters

array $entities: The entities keyed by entity ID.

See also

hook_entity_load()

Related topics

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1083

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.