function FieldStorageConfig::calculateDependencies

Same name in other branches
  1. 8.9.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::calculateDependencies()
  2. 10 core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::calculateDependencies()
  3. 11.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::calculateDependencies()

Overrides ConfigEntityBase::calculateDependencies

File

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

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::entityTypeManager()->getDefinition($this->entity_type);
    $this->addDependency('module', $entity_type->getProvider());
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.