You are here

public static function Flag::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 ConfigEntityBase::preDelete

File

src/Entity/Flag.php, line 490

Class

Flag
Provides the Flag configuration entity.

Namespace

Drupal\flag\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
  parent::preDelete($storage, $entities);
  foreach ($entities as $flag) {
    \Drupal::service('flag')
      ->unflagAllByFlag($flag);
  }
}