function hook_entity_storage_load

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

Act on content entities when loaded from the storage.

The results of this hook will be cached.

Parameters

\Drupal\Core\Entity\EntityInterface[] $entities: The entities keyed by entity ID.

string $entity_type: The type of entities being loaded (i.e. node, user, comment).

See also

hook_entity_load()

Related topics

1 function implements hook_entity_storage_load()

Note: this list is generated by pattern matching, so it 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().
1 invocation of hook_entity_storage_load()
ContentEntityStorageBase::invokeStorageLoadHook in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Invokes hook_entity_storage_load().

File

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

Code

function hook_entity_storage_load(array $entities, $entity_type) {
    foreach ($entities as $entity) {
        $entity->foo = mymodule_add_something_uncached($entity);
    }
}

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