function LibraryDiscovery::getLibraryByName

Same name in other branches
  1. 9 core/lib/Drupal/Core/Asset/LibraryDiscovery.php \Drupal\Core\Asset\LibraryDiscovery::getLibraryByName()
  2. 8.9.x core/lib/Drupal/Core/Asset/LibraryDiscovery.php \Drupal\Core\Asset\LibraryDiscovery::getLibraryByName()
  3. 10 core/lib/Drupal/Core/Asset/LibraryDiscovery.php \Drupal\Core\Asset\LibraryDiscovery::getLibraryByName()

Overrides LibraryDiscoveryInterface::getLibraryByName

File

core/lib/Drupal/Core/Asset/LibraryDiscovery.php, line 44

Class

LibraryDiscovery
Discovers available asset libraries in Drupal.

Namespace

Drupal\Core\Asset

Code

public function getLibraryByName($extension, $name) {
    $libraries = $this->collector
        ->get($extension);
    if (!isset($libraries[$name])) {
        return FALSE;
    }
    if (isset($libraries[$name]['deprecated'])) {
        // phpcs:ignore Drupal.Semantics.FunctionTriggerError
        @trigger_error(str_replace('%library_id%', "{$extension}/{$name}", $libraries[$name]['deprecated']), E_USER_DEPRECATED);
    }
    return $libraries[$name];
}

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