当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentEntityBase::preDelete方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\ContentEntityBase::preDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentEntityBase::preDelete方法的具体用法?PHP ContentEntityBase::preDelete怎么用?PHP ContentEntityBase::preDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\ContentEntityBase的用法示例。


在下文中一共展示了ContentEntityBase::preDelete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
     $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     foreach ($entities as $menu_link) {
         /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */
         $menu_link_manager->removeDefinition($menu_link->getPluginId(), FALSE);
     }
 }
开发者ID:shumer,项目名称:blog,代码行数:13,代码来源:MenuLinkContent.php

示例2: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     // Ensure that all nodes deleted are removed from the search index.
     if (\Drupal::moduleHandler()->moduleExists('search')) {
         foreach ($entities as $entity) {
             search_index_clear('node_search', $entity->nid->value);
         }
     }
 }
开发者ID:brstde,项目名称:gap1,代码行数:13,代码来源:Node.php

示例3: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     foreach ($entities as $entity) {
         // Delete all remaining references to this file.
         $file_usage = \Drupal::service('file.usage')->listUsage($entity);
         if (!empty($file_usage)) {
             foreach ($file_usage as $module => $usage) {
                 \Drupal::service('file.usage')->delete($entity, $module);
             }
         }
         // Delete the actual file. Failures due to invalid files and files that
         // were already deleted are logged to watchdog but ignored, the
         // corresponding file entity will be deleted.
         file_unmanaged_delete($entity->getFileUri());
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:20,代码来源:File.php

示例4: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     $registrant_storage = \Drupal::entityManager()->getStorage('registrant');
     /** @var \Drupal\rng\RegistrationInterface $registration */
     foreach ($entities as $registration) {
         // Delete associated registrants.
         $ids = $registrant_storage->getQuery()->condition('registration', $registration->id(), '=')->execute();
         $registrants = $registrant_storage->loadMultiple($ids);
         $registrant_storage->delete($registrants);
     }
     parent::preDelete($storage, $entities);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:15,代码来源:Registration.php

示例5: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     // We need to check whether the state of the job is affected by this
     // deletion.
     foreach ($entities as $entity) {
         if ($job = $entity->getJob()) {
             // We only care for active jobs.
             if ($job->isActive() && tmgmt_job_check_finished($job->id())) {
                 // Mark the job as finished.
                 $job->finished();
             }
         }
     }
     parent::preDelete($storage, $entities);
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:18,代码来源:JobItem.php

示例6: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     $component_storage = \Drupal::entityManager()->getStorage('rng_rule_component');
     /** @var \Drupal\rng\RuleInterface $rule */
     foreach ($entities as $rule) {
         // Delete associated rule components.
         $ids = $component_storage->getQuery()->condition('rule', $rule->id())->execute();
         $components = $component_storage->loadMultiple($ids);
         $component_storage->delete($components);
     }
     parent::preDelete($storage, $entities);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:15,代码来源:Rule.php


注:本文中的Drupal\Core\Entity\ContentEntityBase::preDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。