Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Asset / LibraryDiscoveryInterface.php
1 <?php
2
3 namespace Drupal\Core\Asset;
4
5 /**
6  * Discovers information for asset (CSS/JavaScript) libraries.
7  *
8  * Library information is statically cached. Libraries are keyed by extension
9  * for several reasons:
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.
17  */
18 interface LibraryDiscoveryInterface {
19
20   /**
21    * Gets all libraries defined by an extension.
22    *
23    * @param string $extension
24    *   The name of the extension that registered a library.
25    *
26    * @return array
27    *   An associative array of libraries registered by $extension is returned
28    *   (which may be empty).
29    *
30    * @see self::getLibraryByName()
31    */
32   public function getLibrariesByExtension($extension);
33
34   /**
35    * Gets a single library defined by an extension by name.
36    *
37    * @param string $extension
38    *   The name of the extension that registered a library.
39    * @param string $name
40    *   The name of a registered library to retrieve.
41    *
42    * @return array|false
43    *   The definition of the requested library, if $name was passed and it
44    *   exists, otherwise FALSE.
45    */
46   public function getLibraryByName($extension, $name);
47
48   /**
49    * Clears static and persistent library definition caches.
50    */
51   public function clearCachedDefinitions();
52
53 }