• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Entity\ConfigEntityBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $entity) {
         entity_invoke_bundle_hook('delete', $entity->getEntityType()->getBundleOf(), $entity->id());
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:ConfigEntityBundleBase.php


示例2: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $entity) {
         $entity->deleteDisplays();
         \Drupal::entityManager()->onBundleDelete($entity->id(), $entity->getEntityType()->getBundleOf());
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:11,代码来源:ConfigEntityBundleBase.php


示例3: preSave

 /**
  * {@inheritdoc}
  */
 public function preSave(EntityStorageInterface $storage)
 {
     parent::preSave($storage);
     $errors = $this->validate();
     if (!empty($errors)) {
         throw new EncryptException(implode(';', $errors));
     }
 }
开发者ID:svendecabooter,项目名称:encrypt,代码行数:11,代码来源:EncryptionProfile.php


示例4: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     parent::calculateDependencies();
     // Make sure we save any explicit module dependencies.
     if ($provider = $this->get('module')) {
         $this->addDependency('module', $provider);
     }
     return $this->dependencies;
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:12,代码来源:MigrationGroup.php


示例5: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     parent::calculateDependencies();
     if ($this->stateFrom) {
         $this->addDependency('config', ModerationState::load($this->stateFrom)->getConfigDependencyName());
     }
     if ($this->stateTo) {
         $this->addDependency('config', ModerationState::load($this->stateTo)->getConfigDependencyName());
     }
     return $this;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:14,代码来源:ModerationStateTransition.php


示例6: preSave

 /**
  * Acts on an entity before the presave hook is invoked.
  *
  * Used before the entity is saved and before invoking the presave hook.
  *
  * Ensure that config entities which are bundles of other entities cannot have
  * their ID changed.
  *
  * @param \Drupal\Core\Entity\EntityStorageInterface $storage
  *   The entity storage object.
  *
  * @throws \Drupal\Core\Config\ConfigNameException
  *   Thrown when attempting to rename a bundle entity.
  */
 public function preSave(EntityStorageInterface $storage)
 {
     parent::preSave($storage);
     // Only handle renames, not creations.
     if (!$this->isNew() && $this->getOriginalId() !== $this->id()) {
         $bundle_type = $this->getEntityType();
         $bundle_of = $bundle_type->getBundleOf();
         if (!empty($bundle_of)) {
             throw new ConfigNameException("The machine name of the '{$bundle_type->getLabel()}' bundle cannot be changed.");
         }
     }
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:26,代码来源:ConfigEntityBundleBase.php


示例7: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     parent::calculateDependencies();
     $prefix = $this->getModerationStateConfigPrefix() . '.';
     if ($this->stateFrom) {
         $this->addDependency('config', $prefix . $this->stateFrom);
     }
     if ($this->stateTo) {
         $this->addDependency('config', $prefix . $this->stateTo);
     }
     return $this;
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:15,代码来源:ModerationStateTransition.php


示例8: 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


示例9: testThirdPartySettings

 /**
  * @covers ::getThirdPartySetting
  * @covers ::setThirdPartySetting
  * @covers ::getThirdPartySettings
  * @covers ::unsetThirdPartySetting
  * @covers ::getThirdPartyProviders
  */
 public function testThirdPartySettings()
 {
     $key = 'test';
     $third_party = 'test_provider';
     $value = $this->getRandomGenerator()->string();
     // Test getThirdPartySetting() with no settings.
     $this->assertEquals($value, $this->entity->getThirdPartySetting($third_party, $key, $value));
     $this->assertNull($this->entity->getThirdPartySetting($third_party, $key));
     // Test setThirdPartySetting().
     $this->entity->setThirdPartySetting($third_party, $key, $value);
     $this->assertEquals($value, $this->entity->getThirdPartySetting($third_party, $key));
     $this->assertEquals($value, $this->entity->getThirdPartySetting($third_party, $key, $this->randomGenerator->string()));
     // Test getThirdPartySettings().
     $this->entity->setThirdPartySetting($third_party, 'test2', 'value2');
     $this->assertEquals(array($key => $value, 'test2' => 'value2'), $this->entity->getThirdPartySettings($third_party));
     // Test getThirdPartyProviders().
     $this->entity->setThirdPartySetting('test_provider2', $key, $value);
     $this->assertEquals(array($third_party, 'test_provider2'), $this->entity->getThirdPartyProviders());
     // Test unsetThirdPartyProviders().
     $this->entity->unsetThirdPartySetting('test_provider2', $key);
     $this->assertEquals(array($third_party), $this->entity->getThirdPartyProviders());
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:29,代码来源:ConfigEntityBaseUnitTest.php


示例10: postCreate

 /**
  * {@inheritdoc}
  */
 public function postCreate(EntityStorageInterface $storage)
 {
     parent::postCreate($storage);
     // If it was not present in the $values passed to create(), (e.g. for
     // programmatic creation), populate the denormalized field_type property
     // from the field storage, so that it gets saved in the config record.
     if (empty($this->field_type)) {
         $this->field_type = $this->getFieldStorageDefinition()->getType();
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:FieldConfigBase.php


示例11: loadMultiple

 /**
  * Get all states in the system, with options to filter, only where a workflow exists.
  *
  * @_deprecated WorkflowState::getStates() ==> WorkflowState::loadMultiple()
  *
  * {@inheritdoc}
  *
  * @param $wid
  *   The requested Workflow ID.
  * @param bool $reset
  *   An option to refresh all caches.
  *
  * @return WorkflowState[] $states
  *   An array of cached states.
  */
 public static function loadMultiple(array $ids = NULL, $wid = '', $reset = FALSE)
 {
     if ($reset) {
         self::$states = array();
     }
     if (empty(self::$states)) {
         self::$states = parent::loadMultiple();
         usort(self::$states, ['Drupal\\workflow\\Entity\\WorkflowState', 'sort']);
     }
     if (!$wid) {
         // All states are requested and cached: return them.
         $result = self::$states;
     } else {
         // All states of only 1 Workflow is requested: return this one.
         // E.g., when called by Workflow->getStates().
         $result = array();
         foreach (self::$states as $state) {
             /* @var $state WorkflowState */
             if ($state->wid == $wid) {
                 $result[$state->id()] = $state;
             }
         }
     }
     return $result;
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:40,代码来源:WorkflowState.php


示例12: preDelete

 /**
  * {@inheritdoc}
  */
 public static function preDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::preDelete($storage, $entities);
     \Drupal::entityManager()->clearCachedFieldDefinitions();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:8,代码来源:EntityDisplayModeBase.php


示例13: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     static::routeBuilder()->setRebuildNeeded();
 }
开发者ID:neeravbm,项目名称:unify-d8,代码行数:8,代码来源:PageVariant.php


示例14: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     parent::calculateDependencies();
     $providers = \Drupal::service('breakpoint.manager')->getGroupProviders($this->breakpoint_group);
     foreach ($providers as $provider => $type) {
         $this->addDependency($type, $provider);
     }
     // Extract all the styles from the image style mappings.
     $styles = ImageStyle::loadMultiple($this->getImageStyleIds());
     array_walk($styles, function ($style) {
         $this->addDependency('config', $style->getConfigDependencyName());
     });
     return $this;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:17,代码来源:ResponsiveImageStyle.php


示例15: getCacheTags

 /**
  * {@inheritdoc}
  */
 public function getCacheTags() {
   $tags = parent::getCacheTags();
   return Cache::mergeTags($tags, ['block_visibility_group:' . $this->id]);
 }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:7,代码来源:BlockVisibilityGroup.php


示例16: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $language_manager = \Drupal::languageManager();
     $language_manager->reset();
     $entity = reset($entities);
     if ($language_manager instanceof ConfigurableLanguageManagerInterface && !$entity->isUninstalling() && !$entity->isSyncing()) {
         $language_manager->updateLockedLanguageWeights();
     }
     // If after deleting this language the site will become monolingual, we need
     // to rebuild language services.
     if (!\Drupal::languageManager()->isMultilingual()) {
         ConfigurableLanguageManager::rebuildServices();
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:18,代码来源:ConfigurableLanguage.php


示例17: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     parent::calculateDependencies();
     if ($this->getPlugin()) {
         $this->addDependency('module', $this->getPlugin()->getPluginDefinition()['provider']);
     }
     return $this;
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:11,代码来源:Translator.php


示例18: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Clear the static caches of filter_formats() and others.
     filter_formats_reset();
     if (!$update && !$this->isSyncing()) {
         // Default configuration of modules and installation profiles is allowed
         // to specify a list of user roles to grant access to for the new format;
         // apply the defined user role permissions when a new format is inserted
         // and has a non-empty $roles property.
         // Note: user_role_change_permissions() triggers a call chain back into
         // \Drupal\filter\FilterPermissions::permissions() and lastly
         // filter_formats(), so its cache must be reset upfront.
         if (($roles = $this->get('roles')) && ($permission = $this->getPermissionName())) {
             foreach (user_roles() as $rid => $name) {
                 $enabled = in_array($rid, $roles, TRUE);
                 user_role_change_permissions($rid, array($permission => $enabled));
             }
         }
     }
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:24,代码来源:FilterFormat.php


示例19: get

 /**
  * {@inheritdoc}
  */
 public function get($property_name)
 {
     if ($property_name == 'default') {
         return $this->isDefault();
     } else {
         return parent::get($property_name);
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:11,代码来源:Language.php


示例20: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     foreach ($entities as $style) {
         // Flush cached media for the deleted style.
         $style->flush();
         // Check whether field settings need to be updated.
         // In case no replacement style was specified, all image fields that are
         // using the deleted style are left in a broken state.
         if (!$style->isSyncing() && ($new_id = $style->getReplacementID())) {
             // The deleted ID is still set as originalID.
             $style->setName($new_id);
             static::replaceImageStyle($style);
         }
     }
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:19,代码来源:ImageStyle.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Entity\ConfigEntityInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Config\TypedConfigManagerInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap