function ShortcutSet::preDelete
Overrides ConfigEntityBase::preDelete
File
- 
              core/modules/ shortcut/ src/ Entity/ ShortcutSet.php, line 92 
Class
- ShortcutSet
- Defines the Shortcut set configuration entity.
Namespace
Drupal\shortcut\EntityCode
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')->accessCheck(FALSE)
      ->condition('shortcut_set', $entity->id(), '=')
      ->execute();
    $controller = \Drupal::entityTypeManager()->getStorage('shortcut');
    $entities = $controller->loadMultiple($shortcut_ids);
    $controller->delete($entities);
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
