function ExtensionListTrait::getPathname

Same name in other branches
  1. 9 core/lib/Drupal/Core/Installer/ExtensionListTrait.php \Drupal\Core\Installer\ExtensionListTrait::getPathname()
  2. 8.9.x core/lib/Drupal/Core/Installer/ExtensionListTrait.php \Drupal\Core\Installer\ExtensionListTrait::getPathname()
  3. 11.x core/lib/Drupal/Core/Installer/ExtensionListTrait.php \Drupal\Core\Installer\ExtensionListTrait::getPathname()

See also

\Drupal\Core\Extension\ExtensionList::getPathname()

File

core/lib/Drupal/Core/Installer/ExtensionListTrait.php, line 36

Class

ExtensionListTrait
Provides common functionality for the extension list classes.

Namespace

Drupal\Core\Installer

Code

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])) {
        // Ensure we don't have to do path scanning more than really needed.
        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.");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.