function EntityOperations::entityInsert

Implements hook_entity_insert().

Attributes

#[Hook('entity_insert', order: Order::Last)]

File

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

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

public function entityInsert(EntityInterface $entity) : void {
  if ($entity->getEntityTypeId() === 'workspace') {
    $this->workspaceAssociation
      ->workspaceInsert($entity);
    $this->workspaceRepository
      ->resetCache();
  }
  if ($this->workspaceInfo
    ->isEntityIgnored($entity) || !$this->workspaceInfo
    ->isEntitySupported($entity)) {
    return;
  }
  $this->workspaceManager
    ->getActiveWorkspace()?->getProvider()
    ->entityInsert($entity);
}

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