function ExtensionList::exists

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

Determines if an extension exists in the filesystem.

Parameters

string $extension_name: The machine name of the extension.

Return value

bool TRUE if the extension exists (regardless installed or not) and FALSE if not.

File

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

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function exists($extension_name) {
    $extensions = $this->getList();
    return isset($extensions[$extension_name]);
}

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