FieldStorageConfig::calculateDependencies

public FieldStorageConfig::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

core/modules/field/src/Entity/FieldStorageConfig.php, line 338

Class

FieldStorageConfig
Defines the Field storage configuration entity.

Namespace

Drupal\field\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();
  // Ensure the field is dependent on the providing module.
  $this->addDependency('module', $this->getTypeProvider());
  // Ask the field type for any additional storage dependencies.
  // @see \Drupal\Core\Field\FieldItemInterface::calculateStorageDependencies()
  $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($this->getType(), FALSE);
  $this->addDependencies($definition['class']::calculateStorageDependencies($this));

  // Ensure the field is dependent on the provider of the entity type.
  $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type);
  $this->addDependency('module', $entity_type->getProvider());
  return $this;
}
doc_Drupal
2016-10-29 09:12:16
Comments
Leave a Comment

Please login to continue.