W3cubDocs

/Drupal 8

protected function ConfigEntityBase::addDependency

protected ConfigEntityBase::addDependency($type, $name)

Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().

Note that this function should only be called from implementations of \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies(), as dependencies are recalculated during every entity save.

See also

\Drupal\Core\Config\Entity\ConfigEntityDependency::hasDependency()

File

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

Class

ConfigEntityBase
Defines a base configuration entity class.

Namespace

Drupal\Core\Config\Entity

Code

protected function addDependency($type, $name) {
  // A config entity is always dependent on its provider. There is no need to
  // explicitly declare the dependency. An explicit dependency on Core, which
  // provides some plugins, is also not needed.
  if ($type == 'module' && ($name == $this->getEntityType()->getProvider() || $name == 'core')) {
    return $this;
  }

  return $this->addDependencyTrait($type, $name);
}

© 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!ConfigEntityBase.php/function/ConfigEntityBase::addDependency/8.1.x