function ConfigEntityDependency::hasDependency
Same name in other branches
- 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::hasDependency()
- 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::hasDependency()
- 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php \Drupal\Core\Config\Entity\ConfigEntityDependency::hasDependency()
Determines if the entity is dependent on extensions or entities.
Parameters
string $type: The type of dependency being checked. Either 'module', 'theme', 'config' or 'content'.
string $name: The specific name to check. If $type equals 'module' or 'theme' then it should be a module name or theme name. In the case of entity it should be the full configuration object name.
Return value
bool TRUE when this entity is dependency on any extension or entity. False otherwise.
File
-
core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityDependency.php, line 87
Class
- ConfigEntityDependency
- Provides a value object to discover configuration dependencies.
Namespace
Drupal\Core\Config\EntityCode
public function hasDependency($type, $name) {
// Add a dependency on the provider module (which defines this config
// entity type, such as 'node' in the case of 'node.type' configuration).
if ($type == 'module' && str_starts_with($this->name, $name . '.')) {
return TRUE;
}
return isset($this->dependencies[$type]) && array_search($name, $this->dependencies[$type]) !== FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.