You are here

public function ExtensionList::getPath in Drupal 9

Same name and namespace in other branches
  1. 8 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));
}