function EntityStorageBase::postLoad

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::postLoad()
  2. 10 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::postLoad()
  3. 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::postLoad()

Attaches data to entities upon loading.

Parameters

array $entities: Associative array of query results, keyed on the entity ID.

3 calls to EntityStorageBase::postLoad()
ContentEntityStorageBase::loadMultipleRevisions in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Loads multiple entity revisions.
ContentEntityStorageBase::loadUnchanged in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Loads an unchanged entity from the database.
EntityStorageBase::loadMultiple in core/lib/Drupal/Core/Entity/EntityStorageBase.php
Loads one or more entities.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 360

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function postLoad(array &$entities) {
  $entity_class = $this->entityClass;
  $entity_class::postLoad($this, $entities);
  // Call hook_entity_load().
  foreach ($this->moduleHandler()
    ->getImplementations('entity_load') as $module) {
    $function = $module . '_entity_load';
    $function($entities, $this->entityTypeId);
  }
  // Call hook_TYPE_load().
  foreach ($this->moduleHandler()
    ->getImplementations($this->entityTypeId . '_load') as $module) {
    $function = $module . '_' . $this->entityTypeId . '_load';
    $function($entities);
  }
}

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