function DrupalKernel::getExtensionNamespacesPsr4

Gets the PSR-4 base directories for extension namespaces.

Parameters

string[] $extension_file_names: Array where each key is an extension name, and each value is a path to the respective *.info.yml file.

Return value

string[] Array where each key is an extension namespace like 'Drupal\system', and each value is the PSR-4 base directory associated with the extension namespace.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1726

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function getExtensionNamespacesPsr4(array $extension_file_names) : array {
  $namespaces = [];
  foreach ($extension_file_names as $extension => $filename) {
    $namespaces["Drupal\\{$extension}"] = dirname($filename) . '/src';
  }
  return $namespaces;
}

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