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


PHP Entity\ConfigEntityBase类代码示例

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


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


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