8.3.x Vocabulary.php public static Vocabulary::preDelete(EntityStorageInterface $storage, array $entities)
8.0.x Vocabulary.php public static Vocabulary::preDelete(EntityStorageInterface $storage, array $entities)
8.1.x Vocabulary.php public static Vocabulary::preDelete(EntityStorageInterface $storage, array $entities)
8.2.x Vocabulary.php public static Vocabulary::preDelete(EntityStorageInterface $storage, array $entities)
8.4.x Vocabulary.php public static Vocabulary::preDelete(EntityStorageInterface $storage, array $entities)

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

core/modules/taxonomy/src/Entity/Vocabulary.php, line 123

Class

Vocabulary
Defines the taxonomy vocabulary entity.

Namespace

Drupal\taxonomy\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
  parent::preDelete($storage, $entities);

  // Only load terms without a parent, child terms will get deleted too.
  entity_delete_multiple('taxonomy_term', $storage->getToplevelTids(array_keys($entities)));
}