W3cubDocs

/Drupal 8

protected function DrupalKernel::classLoaderAddMultiplePsr4

protected DrupalKernel::classLoaderAddMultiplePsr4(array $namespaces = array())

Registers a list of namespaces with PSR-4 directories for class loading.

Parameters

array $namespaces: Array where each key is a namespace like 'Drupal\system', and each value is either a PSR-4 base directory, or an array of PSR-4 base directories associated with this namespace.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function classLoaderAddMultiplePsr4(array $namespaces = array()) {
  foreach ($namespaces as $prefix => $paths) {
    if (is_array($paths)) {
      foreach ($paths as $key => $value) {
        $paths[$key] = $this->root . '/' . $value;
      }
    }
    elseif (is_string($paths)) {
      $paths = $this->root . '/' . $paths;
    }
    $this->classLoader->addPsr4($prefix . '\\', $paths);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::classLoaderAddMultiplePsr4/8.1.x