function ConfigEntityDependency::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::__construct()
  2. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::__construct()
  3. 11.x core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::__construct()

Constructs the configuration entity dependency from the entity values.

Parameters

string $name: The configuration entity's configuration object name.

array $values: (optional) The configuration entity's values.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php, line 36

Class

ConfigEntityDependency
Provides a value object to discover configuration dependencies.

Namespace

Drupal\Core\Config\Entity

Code

public function __construct($name, $values = []) {
    $this->name = $name;
    if (isset($values['dependencies']) && isset($values['dependencies']['enforced'])) {
        // Merge the enforced dependencies into the list of dependencies.
        $enforced_dependencies = $values['dependencies']['enforced'];
        unset($values['dependencies']['enforced']);
        $this->dependencies = NestedArray::mergeDeep($values['dependencies'], $enforced_dependencies);
    }
    elseif (isset($values['dependencies'])) {
        $this->dependencies = $values['dependencies'];
    }
}

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