function Extension::__construct

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

Constructs a new Extension object.

Parameters

string $root: The app root.

string $type: The type of the extension; e.g., 'module'.

string $pathname: The relative path and filename of the extension's info file; e.g., 'core/modules/node/node.info.yml'.

string $filename: (optional) The filename of the main extension file; e.g., 'node.module'.

1 method overrides Extension::__construct()
DatabaseDriver::__construct in core/lib/Drupal/Core/Extension/DatabaseDriver.php
Constructs a new DatabaseDriver object.

File

core/lib/Drupal/Core/Extension/Extension.php, line 71

Class

Extension
Defines an extension (file) object.

Namespace

Drupal\Core\Extension

Code

public function __construct($root, $type, $pathname, $filename = NULL) {
    // @see \Drupal\Core\Theme\ThemeInitialization::getActiveThemeByName()
    assert($pathname === 'core/core.info.yml' || $pathname[0] !== '/' && file_exists($root . '/' . $pathname), sprintf('The file specified by the given app root, relative path and file name (%s) do not exist.', $root . '/' . $pathname));
    $this->root = $root;
    $this->type = $type;
    $this->pathname = $pathname;
    $this->filename = $filename;
}

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