function ExtensionDiscovery::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ExtensionDiscovery.php \Drupal\Core\Extension\ExtensionDiscovery::__construct()
  2. 8.9.x core/lib/Drupal/Core/Extension/ExtensionDiscovery.php \Drupal\Core\Extension\ExtensionDiscovery::__construct()
  3. 10 core/lib/Drupal/Core/Extension/ExtensionDiscovery.php \Drupal\Core\Extension\ExtensionDiscovery::__construct()

Constructs a new ExtensionDiscovery object.

Parameters

string $root: The app root.

bool $use_info_parser: Whether the info_parser should be used. Note this argument also determines if the deprecated file cache property is set to maintain BC in Drupal 11.

string[] $profile_directories: The available profile directories

string $site_path: The path to the site.

File

core/lib/Drupal/Core/Extension/ExtensionDiscovery.php, line 122

Class

ExtensionDiscovery
Discovers available extensions in the filesystem.

Namespace

Drupal\Core\Extension

Code

public function __construct(string $root, $use_info_parser = TRUE, ?array $profile_directories = NULL, ?string $site_path = NULL) {
    $this->root = $root;
    // @phpstan-ignore property.deprecated
    $this->fileCache = $use_info_parser ? FileCacheFactory::get('extension_discovery') : NULL;
    $this->profileDirectories = $profile_directories;
    $this->sitePath = $site_path;
    $this->infoParser = $use_info_parser ? new InfoParser($root) : NULL;
}

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