3 namespace Drupal\Core\Asset;
6 * Discovers information for asset (CSS/JavaScript) libraries.
8 * Library information is statically cached. Libraries are keyed by extension
10 * - Libraries are not unique. Multiple extensions might ship with the same
11 * library in a different version or variant. This registry cannot (and does
12 * not attempt to) prevent library conflicts.
13 * - Extensions implementing and thereby depending on a library that is
14 * registered by another extension can only rely on that extension's library.
15 * - Two (or more) extensions can still register the same library and use it
16 * without conflicts in case the libraries are loaded on certain pages only.
18 interface LibraryDiscoveryInterface {
21 * Gets all libraries defined by an extension.
23 * @param string $extension
24 * The name of the extension that registered a library.
27 * An associative array of libraries registered by $extension is returned
28 * (which may be empty).
30 * @see self::getLibraryByName()
32 public function getLibrariesByExtension($extension);
35 * Gets a single library defined by an extension by name.
37 * @param string $extension
38 * The name of the extension that registered a library.
40 * The name of a registered library to retrieve.
43 * The definition of the requested library, if $name was passed and it
44 * exists, otherwise FALSE.
46 public function getLibraryByName($extension, $name);
49 * Clears static and persistent library definition caches.
51 public function clearCachedDefinitions();