function hook_entity_load
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_load()
- 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_load()
- 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_load()
- 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_load()
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
2 functions implement hook_entity_load()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- entity_crud_hook_test_entity_load in modules/
simpletest/ tests/ entity_crud_hook_test.module - Implements hook_entity_load().
- rdf_entity_load in modules/
rdf/ rdf.module - Implements hook_entity_load().
1 invocation of hook_entity_load()
- DrupalDefaultEntityController::attachLoad in includes/
entity.inc - Attaches data to entities upon loading.
File
-
modules/
system/ system.api.php, line 302
Code
function hook_entity_load($entities, $type) {
foreach ($entities as $entity) {
$entity->foo = mymodule_add_something($entity, $type);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.