コード例 #1
0
 /**
  * {@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());
     }
 }
コード例 #2
0
 /**
  * {@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());
     }
 }
コード例 #3
0
 /**
  * {@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);
         }
     }
 }
コード例 #4
0
ファイル: View.php プロジェクト: 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());
     }
 }
コード例 #5
0
ファイル: ImageStyle.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@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());
     }
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // Invalidate the static caches.
     \Drupal::service('pathauto.generator')->resetCaches();
 }
コード例 #7
0
ファイル: TaxType.php プロジェクト: alexburrows/cream-2.x
 /**
  * {@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);
 }
コード例 #8
0
ファイル: EmbedButton.php プロジェクト: nB-MDSO/mdso-d8blog
 /**
  * {@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());
         }
     }
 }
コード例 #9
0
ファイル: PageVariant.php プロジェクト: neeravbm/unify-d8
 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     static::routeBuilder()->setRebuildNeeded();
 }
コード例 #10
0
ファイル: Index.php プロジェクト: curveagency/intranet
 /**
  * {@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.
         }
     }
 }
コード例 #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();
 }
コード例 #12
0
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     \Drupal::service('router.builder')->setRebuildNeeded();
 }
コード例 #13
0
 /**
  * {@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();
                 }
             }
         }
     }
 }
コード例 #14
0
ファイル: SearchPage.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@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();
     }
 }
コード例 #15
0
ファイル: TaxRate.php プロジェクト: alexburrows/cream-2.x
 /**
  * {@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);
 }
コード例 #16
0
ファイル: ConfigTest.php プロジェクト: alnutile/drunatra
 /**
  * {@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();
         }
     }
 }
コード例 #17
0
ファイル: TaxRate.php プロジェクト: marmouset/drupal
 /**
  * {@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);
         }
     }
 }
コード例 #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();
     }
 }
コード例 #19
0
  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);

    foreach ($entities as $blocktabs) {
    }
  }