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


PHP ConfigEntityBase::postSave方法代码示例

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


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

示例1: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update) {
         entity_invoke_bundle_hook('create', $this->getEntityType()->getBundleOf(), $this->id());
     } elseif ($this->getOriginalId() != $this->id()) {
         entity_invoke_bundle_hook('rename', $this->getEntityType()->getBundleOf(), $this->getOriginalId(), $this->id());
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:ConfigEntityBundleBase.php

示例2: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update) {
         $this->entityManager()->onBundleCreate($this->id(), $this->getEntityType()->getBundleOf());
     } elseif ($this->getOriginalId() != $this->id()) {
         $this->renameDisplays();
         $this->entityManager()->onBundleRename($this->getOriginalId(), $this->id(), $this->getEntityType()->getBundleOf());
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:ConfigEntityBundleBase.php

示例3: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update && !$this->isSyncing()) {
         // Save a new shortcut set with links copied from the user's default set.
         $default_set = shortcut_default_set();
         // This is the default set, do not copy shortcuts.
         if ($default_set->id() != $this->id()) {
             foreach ($default_set->getShortcuts() as $shortcut) {
                 $shortcut = $shortcut->createDuplicate();
                 $shortcut->enforceIsNew();
                 $shortcut->shortcut_set->target_id = $this->id();
                 $shortcut->save();
             }
         }
     }
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:20,代码来源:ShortcutSet.php

示例4: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     $entity_manager = $this->entityManager();
     $bundle_of = $this->getEntityType()->getBundleOf();
     if (!$update) {
         $entity_manager->onBundleCreate($this->id(), $bundle_of);
     } else {
         // Invalidate the render cache of entities for which this entity
         // is a bundle.
         if ($entity_manager->hasHandler($bundle_of, 'view_builder')) {
             $entity_manager->getViewBuilder($bundle_of)->resetCache();
         }
         // Entity bundle field definitions may depend on bundle settings.
         $entity_manager->clearCachedFieldDefinitions();
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:20,代码来源:ConfigEntityBundleBase.php

示例5: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (\Drupal::entityManager()->hasHandler($this->targetEntityType, 'view_builder')) {
         \Drupal::entityManager()->getViewBuilder($this->targetEntityType)->resetCache();
     }
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:10,代码来源:RdfMapping.php

示例6: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Entity::postSave() calls Entity::invalidateTagsOnSave(), which only
     // handles the regular cases. The Block entity has one special case: a
     // newly created block may *also* appear on any page in the current theme,
     // so we must invalidate the associated block's cache tag (which includes
     // the theme cache tag).
     if (!$update) {
         Cache::invalidateTags($this->getCacheTagsToInvalidate());
     }
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:15,代码来源:Block.php

示例7: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     try {
         // Fake an original for inserts to make code cleaner.
         /** @var \Drupal\search_api\IndexInterface $original */
         $original = $update ? $this->original : static::create(array('status' => FALSE));
         $index_task_manager = \Drupal::getContainer()->get('search_api.index_task_manager');
         if ($this->status() && $original->status()) {
             // React on possible changes that would require re-indexing, etc.
             $this->reactToServerSwitch($original);
             $this->reactToDatasourceSwitch($original);
             $this->reactToTrackerSwitch($original);
             $this->reactToProcessorChanges($original);
         } elseif (!$this->status() && $original->status()) {
             if ($this->hasValidTracker()) {
                 $index_task_manager->stopTracking($this);
             }
             if ($original->isServerEnabled()) {
                 $original->getServerInstance()->removeIndex($this);
             }
         } elseif ($this->status() && !$original->status()) {
             $this->getServerInstance()->addIndex($this);
             if ($this->hasValidTracker()) {
                 $index_task_manager->startTracking($this);
             }
         }
         if (!$index_task_manager->isTrackingComplete($this)) {
             // Give tests and site admins the possibility to disable the use of a
             // batch for tracking items. Also, do not use a batch if running in the
             // CLI.
             $use_batch = \Drupal::state()->get('search_api_use_tracking_batch', TRUE);
             if (!$use_batch || php_sapi_name() == 'cli') {
                 $index_task_manager->addItemsAll($this);
             } else {
                 $index_task_manager->addItemsBatch($this);
             }
         }
         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');
         }
         Cache::invalidateTags($this->getCacheTags());
     } catch (SearchApiException $e) {
         watchdog_exception('search_api', $e);
     }
 }
开发者ID:curveagency,项目名称:intranet,代码行数:52,代码来源:Index.php

示例8: postSave

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);

    if ($update) {
      if (!empty($this->original) && $this->id() !== $this->original->id()) {
        // Update field settings if necessary.
        if (!$this->isSyncing()) {
          //static::replaceBlockTabs($this);
        }
      }
      else {

      }
    }
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:18,代码来源:Blocktabs.php

示例9: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     $language_manager = \Drupal::languageManager();
     $language_manager->reset();
     if (!$this->isLocked() && $language_manager instanceof ConfigurableLanguageManagerInterface && !$this->isSyncing()) {
         $language_manager->updateLockedLanguageWeights();
     }
     // Update URL Prefixes for all languages after the
     // LanguageManagerInterface::getLanguages() cache is flushed.
     language_negotiation_url_prefixes_update();
     // If after adding this language the site will become multilingual, we need
     // to rebuild language services.
     if (!$this->preSaveMultilingual && !$update && $language_manager instanceof ConfigurableLanguageManagerInterface) {
         $language_manager::rebuildServices();
     }
     if (!$update) {
         // Install any available language configuration overrides for the language.
         \Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id());
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:24,代码来源:ConfigurableLanguage.php

示例10: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Only set the default language and save it to system.site configuration if
     // it needs to updated.
     if ($this->isDefault() && static::getDefaultLangcode() != $this->id()) {
         // Update the config. Saving the configuration fires and event that causes
         // the container to be rebuilt.
         \Drupal::config('system.site')->set('langcode', $this->id())->save();
         \Drupal::service('language.default')->set($this->toLanguageObject());
     }
     $language_manager = \Drupal::languageManager();
     $language_manager->reset();
     if ($language_manager instanceof ConfigurableLanguageManagerInterface) {
         $language_manager->updateLockedLanguageWeights();
     }
     // Update URL Prefixes for all languages after the new default language is
     // propagated and the LanguageManagerInterface::getLanguages() cache is
     // flushed.
     language_negotiation_url_prefixes_update();
     // If after adding this language the site will become multilingual, we need
     // to rebuild language services.
     if (!$this->preSaveMultilingual && !$update && $language_manager instanceof ConfigurableLanguageManagerInterface) {
         $language_manager::rebuildServices();
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:29,代码来源:Language.php

示例11: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Clear render cache.
     entity_render_cache_clear();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:9,代码来源:Role.php

示例12: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     $this->routeBuilderIndicator()->setRebuildNeeded();
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:8,代码来源:SearchPage.php

示例13: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     // Re-convert entity UUID route parameters back into IDs. This is important
     // if the entity is used later in the same request.
     /** @see static::preSave() */
     $entity_manager = $this->entityManager();
     $this->processEntityRouteParameters($this, function ($entity_type_id, $value) use($entity_manager) {
         $entity = $entity_manager->loadEntityByUuid($entity_type_id, $value);
         // Entity validation should have ensured that this entity in fact exists
         // but we try to avoid incomprehensible fatals at all costs.
         if ($entity instanceof EntityInterface) {
             return $entity->id();
         }
     });
     parent::postSave($storage, $update);
     /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
     $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     // The menu link can just be updated if there is already an menu link entry
     // on both entity and menu link plugin level.
     if ($update && $menu_link_manager->getDefinition($this->getPluginId())) {
         $menu_link_manager->updateDefinition($this->getPluginId(), $this->getPluginDefinition(), FALSE);
     } else {
         $menu_link_manager->addDefinition($this->getPluginId(), $this->getPluginDefinition());
     }
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d8,代码行数:28,代码来源:MenuLinkConfig.php

示例14: postSave

 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     \Drupal::service('router.builder')->setRebuildNeeded();
 }
开发者ID:Jbartsch,项目名称:travelbruh-api,代码行数:5,代码来源:ServiceEndpoint.php

示例15: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     $icon_file = $this->getIconFile();
     if (isset($this->original) && ($old_icon_file = $this->original->getIconFile())) {
         /** @var \Drupal\file\FileInterface $old_icon_file */
         if (!$icon_file || $icon_file->uuid() != $old_icon_file->uuid()) {
             $this->fileUsage()->delete($old_icon_file, 'embed', $this->getEntityTypeId(), $this->id());
         }
     }
     if ($icon_file) {
         $usage = $this->fileUsage()->listUsage($icon_file);
         if (empty($usage['embed'][$this->getEntityTypeId()][$this->id()])) {
             $this->fileUsage()->add($icon_file, 'embed', $this->getEntityTypeId(), $this->id());
         }
     }
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:20,代码来源:EmbedButton.php


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