You are here

public static function Flagging::preDelete in Flag 8.4

Acts on entities before they are deleted and before hooks are invoked.

Used before the entities are deleted and 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::preDelete

File

src/Entity/Flagging.php, line 197

Class

Flagging
Provides the flagging content entity.

Namespace

Drupal\flag\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
  parent::preDelete($storage, $entities);
  $event = new UnflaggingEvent($entities);
  \Drupal::service('event_dispatcher')
    ->dispatch(FlagEvents::ENTITY_UNFLAGGED, $event);
}