ExtensionListTrait.php in Drupal 9
File
core/lib/Drupal/Core/Installer/ExtensionListTrait.php
View source
<?php
namespace Drupal\Core\Installer;
trait ExtensionListTrait {
protected static $staticAddedPathNames;
public function setPathname($extension_name, $pathname) {
parent::setPathname($extension_name, $pathname);
static::$staticAddedPathNames[$extension_name] = $pathname;
}
public function getPathname($extension_name) {
if (isset($this->addedPathNames[$extension_name])) {
return $this->addedPathNames[$extension_name];
}
elseif (isset($this->pathNames[$extension_name])) {
return $this->pathNames[$extension_name];
}
elseif (isset(static::$staticAddedPathNames[$extension_name])) {
return static::$staticAddedPathNames[$extension_name];
}
elseif (($path_names = $this
->getPathnames()) && isset($path_names[$extension_name])) {
foreach ($path_names as $extension => $path_name) {
static::$staticAddedPathNames[$extension] = $path_name;
}
return $path_names[$extension_name];
}
throw new \InvalidArgumentException("The {$this->type} {$extension_name} does not exist.");
}
}