function EntityOperations::entityPreload

Implements hook_entity_preload().

Attributes

#[Hook('entity_preload')]

File

core/modules/workspaces/src/Hook/EntityOperations.php, line 39

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

public function entityPreload(array $ids, string $entity_type_id) : array {
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  if (!$this->workspaceInfo
    ->isEntityTypeSupported($entity_type)) {
    return [];
  }
  return $this->workspaceManager
    ->getActiveWorkspace()?->getProvider()
    ->entityPreload($ids, $entity_type_id) ?? [];
}

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