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