You are here

public static function Domain::postDelete in Domain Access 8

Acts on deleted entities before the delete hook is invoked.

Used after the entities are deleted but before invoking the delete hook.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.

Overrides EntityBase::postDelete

File

domain/src/Entity/Domain.php, line 372

Class

Domain
Defines the domain entity.

Namespace

Drupal\domain\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  foreach ($entities as $entity) {
    $actions = $storage
      ->loadMultiple([
      'domain_default_action.' . $entity
        ->id(),
      'domain_delete_action.' . $entity
        ->id(),
      'domain_disable_action.' . $entity
        ->id(),
      'domain_enable_action.' . $entity
        ->id(),
    ]);
    foreach ($actions as $action) {
      $action
        ->delete();
    }
  }

  // Invalidate cache tags relevant to domains.
  \Drupal::service('cache_tags.invalidator')
    ->invalidateTags([
    'rendered',
    'url.site',
  ]);
}