当前位置: 首页>>代码示例>>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;未经允许,请勿转载。