public static ShortcutSet::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/shortcut/src/Entity/ShortcutSet.php, line 85
Class
- ShortcutSet
- Defines the Shortcut set configuration entity.
Namespace
Drupal\shortcut\Entity
Code
public static function preDelete(EntityStorageInterface $storage, array $entities) { parent::preDelete($storage, $entities); foreach ($entities as $entity) { $storage->deleteAssignedShortcutSets($entity); // Next, delete the shortcuts for this set. $shortcut_ids = \Drupal::entityQuery('shortcut') ->condition('shortcut_set', $entity->id(), '=') ->execute(); $controller = \Drupal::entityManager()->getStorage('shortcut'); $entities = $controller->loadMultiple($shortcut_ids); $controller->delete($entities); } }
Please login to continue.