function ExtensionList::getPath

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

Gets the path to an extension of a specific type (module, theme, etc.).

The path is the directory in which the .info file is located. This name is coming from \SplFileInfo.

Parameters

string $extension_name: The machine name of the extension for which the path is requested.

Return value

string The Drupal-root-relative path to the specified extension.

Throws

\Drupal\Core\Extension\Exception\UnknownExtensionException If there is no extension with the supplied name.

1 method overrides ExtensionList::getPath()
DatabaseDriverList::getPath in core/lib/Drupal/Core/Extension/DatabaseDriverList.php

File

core/lib/Drupal/Core/Extension/ExtensionList.php, line 537

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function getPath($extension_name) {
    return dirname($this->getPathname($extension_name));
}

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