protected DependencyTrait::addDependency($type, $name)
Adds a dependency.
string $type: Type of dependency being added: 'module', 'theme', 'config', 'content'.
string $name: If $type is 'module' or 'theme', the name of the module or theme. If $type is 'config' or 'content', the result of EntityInterface::getConfigDependencyName().
$this
\Drupal\Core\Entity\EntityInterface::getConfigDependencyName()
protected function addDependency($type, $name) { if (empty($this->dependencies[$type])) { $this->dependencies[$type] = array($name); if (count($this->dependencies) > 1) { // Ensure a consistent order of type keys. ksort($this->dependencies); } } elseif (!in_array($name, $this->dependencies[$type])) { $this->dependencies[$type][] = $name; // Ensure a consistent order of dependency names. sort($this->dependencies[$type], SORT_FLAG_CASE); } return $this; }
© 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!Entity!DependencyTrait.php/function/DependencyTrait::addDependency/8.1.x