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.

5 calls to DrupalKernel::getExtensionNamespacesPsr4()
DrupalKernel::compileContainer in core/lib/Drupal/Core/DrupalKernel.php
Compiles a new service container.
DrupalKernel::discoverServiceProviders in core/lib/Drupal/Core/DrupalKernel.php
Discovers available serviceProviders.
DrupalKernel::getModuleNamespacesPsr4 in core/lib/Drupal/Core/DrupalKernel.php
Gets the PSR-4 base directories for module namespaces.
DrupalKernel::updateModules in core/lib/Drupal/Core/DrupalKernel.php
Implements Drupal\Core\DrupalKernelInterface::updateModules().
DrupalKernel::updateThemes in core/lib/Drupal/Core/DrupalKernel.php
Updates the kernel's list of themes to the new list.

File

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

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.