You are here

public static function EventType::postDelete in RNG - Events and Registrations 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

src/Entity/EventType.php, line 436

Class

EventType
Defines the event type entity.

Namespace

Drupal\rng\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  if ($event_type = reset($entities)) {
    EventType::courierContextCC($event_type->entity_type, 'delete');
  }

  // Rebuild routes and local tasks.
  \Drupal::service('router.builder')
    ->setRebuildNeeded();

  // Rebuild local actions https://github.com/dpi/rng/issues/18
  \Drupal::service('plugin.manager.menu.local_action')
    ->clearCachedDefinitions();
}