You are here

public function ExtensionList::getPathnames in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPathnames()
  2. 9 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[]

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;
}