function FieldConfigBase::calculateDependencies
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::calculateDependencies()
- 8.9.x core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::calculateDependencies()
- 11.x core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::calculateDependencies()
Overrides ConfigEntityBase::calculateDependencies
1 call to FieldConfigBase::calculateDependencies()
- FieldConfig::calculateDependencies in core/
modules/ field/ src/ Entity/ FieldConfig.php - Calculates dependencies and stores them in the dependency property.
1 method overrides FieldConfigBase::calculateDependencies()
- FieldConfig::calculateDependencies in core/
modules/ field/ src/ Entity/ FieldConfig.php - Calculates dependencies and stores them in the dependency property.
File
-
core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php, line 236
Class
- FieldConfigBase
- Base class for configurable field definitions.
Namespace
Drupal\Core\FieldCode
public function calculateDependencies() {
parent::calculateDependencies();
// Add dependencies from the field type plugin. We can not use
// self::calculatePluginDependencies() because instantiation of a field item
// plugin requires a parent entity.
/** @var \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager */
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
$definition = $field_type_manager->getDefinition($this->getType());
$this->addDependency('module', $definition['provider']);
// Plugins can declare additional dependencies in their definition.
if (isset($definition['config_dependencies'])) {
$this->addDependencies($definition['config_dependencies']);
}
// Let the field type plugin specify its own dependencies.
// @see \Drupal\Core\Field\FieldItemInterface::calculateDependencies()
$this->addDependencies($definition['class']::calculateDependencies($this));
// Create dependency on the bundle.
$bundle_config_dependency = $this->entityTypeManager()
->getDefinition($this->entity_type)
->getBundleConfigDependency($this->bundle);
$this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.