當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigEntityBase::preDelete方法代碼示例

本文整理匯總了PHP中Drupal\Core\Config\Entity\ConfigEntityBase::preDelete方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigEntityBase::preDelete方法的具體用法?PHP ConfigEntityBase::preDelete怎麽用?PHP ConfigEntityBase::preDelete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Config\Entity\ConfigEntityBase的用法示例。


在下文中一共展示了ConfigEntityBase::preDelete方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preDelete

 /**
  * {@inheritdoc}
  */
 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);
     }
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:15,代碼來源:ShortcutSet.php

示例2: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $field_storages)
 {
     $state = \Drupal::state();
     // Set the static flag so that we don't delete field storages whilst
     // deleting fields.
     static::$inDeletion = TRUE;
     // Delete or fix any configuration that is dependent, for example, fields.
     parent::preDelete($storage, $field_storages);
     // Keep the field definitions in the state storage so we can use them later
     // during field_purge_batch().
     $deleted_storages = $state->get('field.storage.deleted') ?: array();
     foreach ($field_storages as $field_storage) {
         if (!$field_storage->deleted) {
             $config = $field_storage->toArray();
             $config['deleted'] = TRUE;
             $config['bundles'] = $field_storage->getBundles();
             $deleted_storages[$field_storage->uuid()] = $config;
         }
     }
     $state->set('field.storage.deleted', $deleted_storages);
 }
開發者ID:nsp15,項目名稱:Drupal8,代碼行數:24,代碼來源:FieldStorageConfig.php

示例3: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     // We are never going to have many entities here, so we can risk a loop.
     foreach ($entities as $key => $name) {
         // Find active jobs associated with the translator that is being deleted.
         $job_ids = \Drupal::entityQuery('tmgmt_job')->condition('state', [Job::STATE_ACTIVE, Job::STATE_CONTINUOUS, Job::STATE_UNPROCESSED], 'IN')->condition('translator', $key)->execute();
         $jobs = Job::loadMultiple($job_ids);
         /** @var \Drupal\tmgmt\JobInterface $job */
         foreach ($jobs as $job) {
             $job->aborted('Job has been aborted because the translation provider %provider was deleted.', ['%provider' => $job->getTranslatorLabel()]);
         }
     }
     parent::preDelete($storage, $entities);
 }
開發者ID:andrewl,項目名稱:andrewlnet,代碼行數:17,代碼來源:Translator.php

示例4: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     \Drupal::entityManager()->clearCachedFieldDefinitions();
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:8,代碼來源:EntityDisplayModeBase.php

示例5: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     /** @var \Drupal\search_api\IndexInterface[] $entities */
     foreach ($entities as $index) {
         if ($index->hasValidTracker()) {
             $index->getTrackerInstance()->trackAllItemsDeleted();
         }
         if ($index->hasValidServer()) {
             $index->getServerInstance()->removeIndex($index);
         }
     }
 }
開發者ID:curveagency,項目名稱:intranet,代碼行數:16,代碼來源:Index.php

示例6: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     // Call the remove() hook on the individual displays.
     /** @var \Drupal\views\ViewEntityInterface $entity */
     foreach ($entities as $entity) {
         $executable = Views::executableFactory()->get($entity);
         foreach ($entity->get('display') as $display_id => $display) {
             $executable->setDisplay($display_id);
             $executable->getDisplay()->remove();
         }
     }
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:16,代碼來源:View.php

示例7: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities) {
   parent::preDelete($storage, $entities);
   /** @var \Drupal\search_api\IndexInterface[] $entities */
   foreach ($entities as $index) {
     if ($index->hasValidTracker()) {
       $index->getTracker()->trackAllItemsDeleted();
     }
     if ($index->hasValidServer()) {
       $index->getServer()->removeIndex($index);
     }
   }
   if (\Drupal::moduleHandler()->moduleExists('views')) {
     views_invalidate_cache();
   }
 }
開發者ID:jkyto,項目名稱:agolf,代碼行數:18,代碼來源:Index.php

示例8: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     // @todo This will, via Index::onDependencyRemoval(), remove all indexes
     //   from this server, triggering the server's removeIndex() method. This
     //   is, at best, wasted performance and could at worst lead to a bug if
     //   removeIndex() saves the server. We should try what happens when this is
     //   the case, whether there really is a bug, and try to fix it somehow
     //   (maybe clever detection of this case in removeIndex() or
     //   Index::postSave(). $server->isUninstalling() might help?
     parent::preDelete($storage, $entities);
     // Iterate through the servers, executing the backends' preDelete() methods
     // and removing all their pending server tasks.
     foreach ($entities as $server) {
         /** @var \Drupal\search_api\ServerInterface $server */
         if ($server->hasValidBackend()) {
             $server->getBackend()->preDelete();
         }
         \Drupal::getContainer()->get('search_api.server_task_manager')->delete(NULL, $server);
     }
 }
開發者ID:curveagency,項目名稱:intranet,代碼行數:23,代碼來源:Server.php


注:本文中的Drupal\Core\Config\Entity\ConfigEntityBase::preDelete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。