當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。