function AutoloadingStorage::__construct

Same name and namespace in other branches
  1. main core/lib/Drupal/Core/Config/AutoloadingStorage.php \Drupal\Core\Config\AutoloadingStorage::__construct()

Constructs a new AutoloadingStorage.

Parameters

\Drupal\Core\Config\StorageInterface $storage: A configuration storage to be wrapped.

string[] $newExtensions: A list of new extensions in the source storage that we need to allow to autoload while reading. The values should be absolute paths to the extension directory.

File

core/lib/Drupal/Core/Config/AutoloadingStorage.php, line 36

Class

AutoloadingStorage
Defines the autoloading storage.

Namespace

Drupal\Core\Config

Code

public function __construct(protected StorageInterface $storage, array $newExtensions = []) {
  if (!empty($newExtensions)) {
    $this->classloader = new ClassLoader();
    foreach ($newExtensions as $extension => $dir) {
      $this->classloader
        ->addPsr4("Drupal\\{$extension}\\", $dir . '/src');
    }
  }
}

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