function EntityDisplayBase::calculateDependencies
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::calculateDependencies()
- 10 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::calculateDependencies()
- 11.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::calculateDependencies()
Overrides ConfigEntityBase::calculateDependencies
1 call to EntityDisplayBase::calculateDependencies()
- LayoutBuilderEntityViewDisplay::calculateDependencies in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php - Calculates dependencies and stores them in the dependency property.
1 method overrides EntityDisplayBase::calculateDependencies()
- LayoutBuilderEntityViewDisplay::calculateDependencies in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php - Calculates dependencies and stores them in the dependency property.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php, line 268
Class
- EntityDisplayBase
- Provides a common base class for entity view and form displays.
Namespace
Drupal\Core\EntityCode
public function calculateDependencies() {
parent::calculateDependencies();
$target_entity_type = $this->entityTypeManager()
->getDefinition($this->targetEntityType);
// Create dependency on the bundle.
$bundle_config_dependency = $target_entity_type->getBundleConfigDependency($this->bundle);
$this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
// If field.module is enabled, add dependencies on 'field_config' entities
// for both displayed and hidden fields. We intentionally leave out base
// field overrides, since the field still exists without them.
if (\Drupal::moduleHandler()->moduleExists('field')) {
$components = $this->content + $this->hidden;
$field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions($this->targetEntityType, $this->bundle);
foreach (array_intersect_key($field_definitions, $components) as $field_definition) {
if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') {
$this->addDependency('config', $field_definition->getConfigDependencyName());
}
}
}
// Depend on configured modes.
if ($this->mode != 'default') {
$mode_entity = $this->entityTypeManager()
->getStorage('entity_' . $this->displayContext . '_mode')
->load($target_entity_type->id() . '.' . $this->mode);
$this->addDependency('config', $mode_entity->getConfigDependencyName());
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.