function ExtensionList::getExtensionInfo

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

Returns information about a specified extension.

This function returns the contents of the .info.yml file for the specified extension.

Parameters

string $extension_name: The name of an extension whose information shall be returned.

Return value

mixed[] An associative array of extension information.

Throws

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

1 method overrides ExtensionList::getExtensionInfo()
DatabaseDriverList::getExtensionInfo in core/lib/Drupal/Core/Extension/DatabaseDriverList.php
Returns information about a specified extension.

File

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

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function getExtensionInfo($extension_name) {
    $all_info = $this->getAllInstalledInfo();
    if (isset($all_info[$extension_name])) {
        return $all_info[$extension_name];
    }
    throw new UnknownExtensionException("The {$this->type} {$extension_name} does not exist or is not installed.");
}

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