You are here

public function ExtensionList::getExtensionInfo in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::getExtensionInfo()
  2. 10 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.

File

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

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.");
}