Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php \Drupal\Core\Config\Entity\ConfigEntityBase::calculateDependencies()
  2. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php \Drupal\Core\Config\Entity\ConfigEntityBase::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityInterface::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

11 calls to ConfigEntityBase::calculateDependencies()
Block::calculateDependencies in core/modules/block/src/Entity/Block.php
Calculates dependencies and stores them in the dependency property.
ConfigEntityBase::preSave in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Acts on an entity before the presave hook is invoked.
ConfigTest::calculateDependencies in core/modules/config/tests/config_test/src/Entity/ConfigTest.php
Calculates dependencies and stores them in the dependency property.
Editor::calculateDependencies in core/modules/editor/src/Entity/Editor.php
Calculates dependencies and stores them in the dependency property.
EntityDisplayBase::calculateDependencies in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Calculates dependencies and stores them in the dependency property.

... See full list

10 methods override ConfigEntityBase::calculateDependencies()
Block::calculateDependencies in core/modules/block/src/Entity/Block.php
Calculates dependencies and stores them in the dependency property.
ConfigTest::calculateDependencies in core/modules/config/tests/config_test/src/Entity/ConfigTest.php
Calculates dependencies and stores them in the dependency property.
Editor::calculateDependencies in core/modules/editor/src/Entity/Editor.php
Calculates dependencies and stores them in the dependency property.
EntityDisplayBase::calculateDependencies in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Calculates dependencies and stores them in the dependency property.
FieldConfigBase::calculateDependencies in core/lib/Drupal/Core/Field/FieldConfigBase.php
Calculates dependencies and stores them in the dependency property.

... See full list

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 372

Class

ConfigEntityBase

Namespace

Drupal\Core\Config\Entity

Code

public function calculateDependencies() {

  // All dependencies should be recalculated on every save apart from enforced
  // dependencies. This ensures stale dependencies are never saved.
  $this->dependencies = array_intersect_key($this->dependencies, [
    'enforced' => '',
  ]);
  if ($this instanceof EntityWithPluginCollectionInterface) {

    // Configuration entities need to depend on the providers of any plugins
    // that they store the configuration for.
    foreach ($this
      ->getPluginCollections() as $plugin_collection) {
      foreach ($plugin_collection as $instance) {
        $this
          ->calculatePluginDependencies($instance);
      }
    }
  }
  if ($this instanceof ThirdPartySettingsInterface) {

    // Configuration entities need to depend on the providers of any third
    // parties that they store the configuration for.
    foreach ($this
      ->getThirdPartyProviders() as $provider) {
      $this
        ->addDependency('module', $provider);
    }
  }
  return $this;
}