W3cubDocs

/Drupal 8

public function ConfigEntityDependency::hasDependency

public ConfigEntityDependency::hasDependency($type, $name)

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

File

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

Class

ConfigEntityDependency
Provides a value object to discover configuration dependencies.

Namespace

Drupal\Core\Config\Entity

Code

public function hasDependency($type, $name) {
  // A config entity is always dependent on its provider.
  if ($type == 'module' && strpos($this->name, $name . '.') === 0) {
    return TRUE;
  }
  return isset($this->dependencies[$type]) && array_search($name, $this->dependencies[$type]) !== FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!Entity!ConfigEntityDependency.php/function/ConfigEntityDependency::hasDependency/8.1.x