function ExtensionList::get

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

3 calls to ExtensionList::get()
DatabaseDriverList::get in core/lib/Drupal/Core/Extension/DatabaseDriverList.php
DatabaseDriverList::getFromDriverName in core/lib/Drupal/Core/Extension/DatabaseDriverList.php
Returns the first available driver extension by the driver name.
ExtensionList::checkIncompatibility in core/lib/Drupal/Core/Extension/ExtensionList.php
Tests the compatibility of an extension.
1 method overrides ExtensionList::get()
DatabaseDriverList::get in core/lib/Drupal/Core/Extension/DatabaseDriverList.php

File

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

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.