/**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $entity) {
         entity_invoke_bundle_hook('delete', $entity->getEntityType()->getBundleOf(), $entity->id());
     }
 }
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $entity) {
         $entity->deleteDisplays();
         \Drupal::entityManager()->onBundleDelete($entity->id(), $entity->getEntityType()->getBundleOf());
     }
 }
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $style) {
         // Flush cached media for the deleted style.
         $style->flush();
         // Check whether field settings need to be updated.
         // In case no replacement style was specified, all image fields that are
         // using the deleted style are left in a broken state.
         if (!$style->isSyncing() && ($new_id = $style->getReplacementID())) {
             // The deleted ID is still set as originalID.
             $style->setName($new_id);
             static::replaceImageStyle($style);
         }
     }
 }
Example #4
0
File: View.php Project: shumer/blog
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $tempstore = \Drupal::service('user.tempstore')->get('views');
     foreach ($entities as $entity) {
         $tempstore->delete($entity->id());
     }
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     /** @var \Drupal\image\ImageStyleInterface[] $entities */
     foreach ($entities as $style) {
         // Flush cached media for the deleted style.
         $style->flush();
         // Clear the replacement ID, if one has been previously stored.
         /** @var \Drupal\image\ImageStyleStorageInterface $storage */
         $storage->clearReplacementId($style->id());
     }
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // Invalidate the static caches.
     \Drupal::service('pathauto.generator')->resetCaches();
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     /** @var \Drupal\commerce_tax\Entity\TaxTypeInterface[] $entities */
     parent::postDelete($storage, $entities);
     // Delete the tax rates of each tax type.
     $rates = [];
     foreach ($entities as $entity) {
         foreach ($entity->getRates() as $rate) {
             $rates[$rate->id()] = $rate;
         }
     }
     /** @var \Drupal\Core\Entity\EntityStorageInterface $rate_storage */
     $rate_storage = \Drupal::service('entity_type.manager')->getStorage('commerce_tax_rate');
     $rate_storage->delete($rates);
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // Remove file usage for any button icons.
     foreach ($entities as $entity) {
         /** @var \Drupal\embed\EmbedButtonInterface $entity */
         if ($icon_file = $entity->getIconFile()) {
             \Drupal::service('file.usage')->delete($icon_file, 'embed', $entity->getEntityTypeId(), $entity->id());
         }
     }
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     static::routeBuilder()->setRebuildNeeded();
 }
Example #10
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     if (\Drupal::moduleHandler()->moduleExists('views')) {
         Views::viewsData()->clear();
         // Remove this line when https://www.drupal.org/node/2370365 gets fixed.
         Cache::invalidateTags(array('extension:views'));
         \Drupal::cache('discovery')->delete('views:wizard');
     }
     /** @var \Drupal\user\SharedTempStore $temp_store */
     $temp_store = \Drupal::service('user.shared_tempstore')->get('search_api_index');
     foreach ($entities as $entity) {
         try {
             $temp_store->delete($entity->id());
         } catch (TempStoreException $e) {
             // Can't really be helped, I guess. But is also very unlikely to happen.
             // Ignore it.
         }
     }
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     if ($event_type = reset($entities)) {
         EventType::courierContextCC($event_type->entity_type, 'delete');
     }
     // Rebuild routes and local tasks.
     \Drupal::service('router.builder')->setRebuildNeeded();
     // Rebuild local actions https://github.com/dpi/rng/issues/18
     \Drupal::service('plugin.manager.menu.local_action')->clearCachedDefinitions();
 }
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     \Drupal::service('router.builder')->setRebuildNeeded();
 }
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     /** @var \Drupal\simplenews\Subscription\SubscriptionManagerInterface $subscription_manager */
     $subscription_manager = \Drupal::service('simplenews.subscription_manager');
     foreach ($entities as $newsletter) {
         $subscription_manager->deleteSubscriptions(array('subscriptions_target_id' => $newsletter->id()));
         drupal_set_message(t('All subscriptions to newsletter %newsletter have been deleted.', array('%newsletter' => $newsletter->label())));
     }
     if (\Drupal::moduleHandler()->moduleExists('block')) {
         // Make sure there are no active blocks for these newsletters.
         $ids = \Drupal::entityQuery('block')->condition('plugin', 'simplenews_subscription_block')->condition('settings.newsletters.*', array_keys($entities), 'IN')->execute();
         if ($ids) {
             $blocks = Block::loadMultiple($ids);
             foreach ($blocks as $block) {
                 $settings = $block->get('settings');
                 foreach ($entities as $newsletter) {
                     if (in_array($newsletter->id(), $settings['newsletters'])) {
                         unset($settings['newsletters'][array_search($newsletter->id(), $settings['newsletters'])]);
                     }
                 }
                 // If there are no enabled newsletters left, delete the block.
                 if (empty($settings['newsletters'])) {
                     $block->delete();
                 } else {
                     // otherwise, update the settings and save.
                     $block->set('settings', $settings);
                     $block->save();
                 }
             }
         }
     }
 }
Example #14
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $search_page_repository = \Drupal::service('search.search_page_repository');
     if (!$search_page_repository->isSearchActive()) {
         $search_page_repository->clearDefaultSearchPage();
     }
 }
Example #15
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     /** @var \Drupal\commerce_tax\Entity\TaxRateInterface $entity */
     parent::postDelete($storage, $entities);
     // Delete the tax rates amounts of each tax rate.
     $amounts = [];
     foreach ($entities as $entity) {
         foreach ($entity->getAmounts() as $amount) {
             $amounts[$amount->id()] = $amount;
         }
     }
     /** @var \Drupal\Core\Entity\EntityStorageInterface $rate_storage */
     $amount_storage = \Drupal::service('entity_type.manager')->getStorage('commerce_tax_rate_amount');
     $amount_storage->delete($amounts);
 }
Example #16
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $entity) {
         if ($entity->id() == 'deleter') {
             $deletee = $storage->load('deletee');
             $deletee->delete();
         }
     }
 }
Example #17
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // Delete all tax rate amounts of each tax rate.
     foreach ($entities as $entity) {
         if ($entity->hasAmounts()) {
             $amountStorage = \Drupal::service('entity_type.manager')->getStorage('commerce_tax_rate_amount');
             $amounts = $amountStorage->loadMultiple($entity->getAmounts());
             $amountStorage->delete($amounts);
         }
     }
 }
Example #18
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $language_manager = \Drupal::languageManager();
     $language_manager->reset();
     $entity = reset($entities);
     if ($language_manager instanceof ConfigurableLanguageManagerInterface && !$entity->isUninstalling() && !$entity->isSyncing()) {
         $language_manager->updateLockedLanguageWeights();
     }
     // If after deleting this language the site will become monolingual, we need
     // to rebuild language services.
     if (!\Drupal::languageManager()->isMultilingual()) {
         ConfigurableLanguageManager::rebuildServices();
     }
 }
Example #19
0
  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);

    foreach ($entities as $blocktabs) {
    }
  }