function EntityOperations::entityPredelete

Same name and namespace in other branches
  1. 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityPredelete()
  2. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityPredelete()
  3. 8.9.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityPredelete()

Implements hook_entity_predelete().

Attributes

#[Hook('entity_predelete')]

File

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

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

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

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