function ExtensionList::getPathnames

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPathnames()
  2. 10 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPathNames()
  3. 11.x core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPathNames()

Returns a list of extension file paths keyed by machine name.

Return value

string[]

1 call to ExtensionList::getPathnames()
ExtensionList::getPathname in core/lib/Drupal/Core/Extension/ExtensionList.php
Gets the info file path for an extension.

File

core/lib/Drupal/Core/Extension/ExtensionList.php, line 414

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function getPathnames() {
    if ($this->pathNames === NULL) {
        $cache_id = $this->getPathnamesCacheId();
        if ($cache = $this->cache
            ->get($cache_id)) {
            $path_names = $cache->data;
        }
        elseif (!($path_names = $this->state
            ->get($cache_id))) {
            $path_names = $this->recalculatePathnames();
            // Store filenames to allow static::getPathname() to retrieve them
            // without having to rebuild or scan the filesystem.
            $this->state
                ->set($cache_id, $path_names);
            $this->cache
                ->set($cache_id, $path_names);
        }
        $this->pathNames = $path_names;
    }
    return $this->pathNames;
}

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