public function ExtensionList::get in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::get()
- 9 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.
File
- core/
lib/ Drupal/ Core/ Extension/ ExtensionList.php, line 259
Class
- ExtensionList
- Provides available extensions.
Namespace
Drupal\Core\ExtensionCode
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.");
}