function DatabaseDriverList::getPathname

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Extension/DatabaseDriverList.php \Drupal\Core\Extension\DatabaseDriverList::getPathname()

Gets the info file path for an extension.

The info path, whether provided, cached, or retrieved from the database, is only returned if the file exists.

This function plays a key role in allowing Drupal's extensions (modules, themes, profiles, theme_engines, etc.) to be located in different places depending on a site's configuration. For example, a module 'foo' may legally be located in any of these four places:

  • core/modules/foo/foo.info.yml
  • modules/foo/foo.info.yml
  • sites/all/modules/foo/foo.info.yml
  • sites/example.com/modules/foo/foo.info.yml

while a theme 'bar' may be located in any of the following four places:

  • core/themes/bar/bar.info.yml
  • themes/bar/bar.info.yml
  • sites/all/themes/bar/bar.info.yml
  • sites/example.com/themes/bar/bar.info.yml

An installation profile maybe be located in any of the following places:

  • core/profiles/baz/baz.info.yml
  • profiles/baz/baz.info.yml

Calling ExtensionList::getPathname('foo') will give you one of the above, depending on where the extension is located and what type it is.

Parameters

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

Return value

string The drupal-root relative filename and path of the requested extension's .info.yml file.

Overrides ExtensionList::getPathname

File

core/lib/Drupal/Core/Extension/DatabaseDriverList.php, line 228

Class

DatabaseDriverList
Provides a list of available database drivers.

Namespace

Drupal\Core\Extension

Code

public function getPathname($extension_name) {
    throw new \LogicException(__METHOD__ . '() is not implemented');
}

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