function hook_ENTITY_TYPE_load
Act on entities of a specific type when loaded.
Parameters
array $entities: The entities keyed by entity ID.
See also
Related topics
3 functions implement hook_ENTITY_TYPE_load()
Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.
- comment_entity_storage_load in core/modules/ comment/ comment.module 
- Implements hook_entity_storage_load().
- config_entity_static_cache_test_config_test_load in core/modules/ config/ tests/ config_entity_static_cache_test/ config_entity_static_cache_test.module 
- Implements hook_ENTITY_TYPE_load() for 'static_cache_test_config_test'.
- views_entity_test_entity_load in core/modules/ views/ tests/ modules/ views_entity_test/ views_entity_test.module 
- Implements hook_entity_load().
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.
