public EntityDisplayBase::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/lib/Drupal/Core/Entity/EntityDisplayBase.php, line 250
Class
- EntityDisplayBase
- Provides a common base class for entity view and form displays.
Namespace
Drupal\Core\Entity
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | public function calculateDependencies() { parent::calculateDependencies(); $target_entity_type = $this ->entityManager()->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 = $this ->entityManager()->getFieldDefinitions( $this ->targetEntityType, $this ->bundle); foreach ( array_intersect_key ( $field_definitions , $components ) as $field_name => $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 ->entityManager()->getStorage( 'entity_' . $this ->displayContext . '_mode' )->load( $target_entity_type ->id() . '.' . $this ->mode); $this ->addDependency( 'config' , $mode_entity ->getConfigDependencyName()); } return $this ; } |
Please login to continue.