function ExtensionList::get

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

Returns a single extension.

Parameters

string $extension_name: The machine name of the extension.

Return value

\Drupal\Core\Extension\Extension A processed extension object for the extension with the specified machine name.

Throws

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

1 call to ExtensionList::get()
ExtensionList::checkIncompatibility in core/lib/Drupal/Core/Extension/ExtensionList.php
Tests the compatibility of an extension.

File

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

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function get($extension_name) {
    $extensions = $this->getList();
    if (isset($extensions[$extension_name])) {
        return $extensions[$extension_name];
    }
    throw new UnknownExtensionException("The {$this->type} {$extension_name} does not exist.");
}

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