You are here

public function InfoParserDynamic::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Extension/InfoParserDynamic.php \Drupal\Core\Extension\InfoParserDynamic::__construct()
  2. 9 core/lib/Drupal/Core/Extension/InfoParserDynamic.php \Drupal\Core\Extension\InfoParserDynamic::__construct()

InfoParserDynamic constructor.

Parameters

string|null $app_root: The root directory of the Drupal installation.

File

core/lib/Drupal/Core/Extension/InfoParserDynamic.php, line 27

Class

InfoParserDynamic
Parses dynamic .info.yml files that might change during the page request.

Namespace

Drupal\Core\Extension

Code

public function __construct(string $app_root = NULL) {
  if ($app_root === NULL) {

    // @todo https://www.drupal.org/project/drupal/issues/3087975 Require
    //   $app_root argument.
    $app_root = \Drupal::hasService('kernel') ? \Drupal::root() : DRUPAL_ROOT;
  }
  $this->root = $app_root;
}