function ExtensionList::getPath

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPath()
  2. 10 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getPath()
  3. 11.x 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.

File

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

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.