Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Asset / AssetLibraryInterface.php
1 <?php
2
3 namespace Drupal\libraries\ExternalLibrary\Asset;
4
5 use Drupal\libraries\ExternalLibrary\Dependency\DependentLibraryInterface;
6 use Drupal\libraries\ExternalLibrary\LibraryInterface;
7 use Drupal\libraries\ExternalLibrary\LibraryManagerInterface;
8 use Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface;
9
10 /**
11  * Provides an interface for external asset libraries with a single library.
12  *
13  * Asset is the generic term for CSS and JavaScript files.
14  *
15  * In order to load assets of external libraries as part of a page request the
16  * assets must be registered with Drupal core's library system. Therefore,
17  * Libraries API makes all libraries that are required by the installed
18  * installation profile, modules, and themes available as core asset libraries
19  * with the identifier 'libraries/[machine_name]' where '[machine_name]' is
20  * the Libraries API machine name of the external library.
21  *
22  * Thus, assuming that the external library 'flexslider' has been declared as a
23  * dependency, for example, it can be attached to a render array in the $build
24  * variable with the following code:
25  * @code
26  *   $build['#attached']['library'] = ['libraries/flexslider'];
27  * @endcode
28  *
29  * In some cases an external library may contain multiple components, that
30  * should be loadable independently from each other. In this case, implement
31  * MultipleAssetLibraryInterface instead.
32  *
33  * @see libraries_library_info_build()
34  * @see \Drupal\libraries\ExternalLibrary\Asset\AssetLibraryTrait
35  * @see \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface
36  *
37  * @todo Support loading of source or minified assets.
38  * @todo Document how library dependencies work.
39  *
40  * @ingroup libraries
41  */
42 interface AssetLibraryInterface extends
43   LibraryInterface,
44   VersionedLibraryInterface,
45   DependentLibraryInterface
46 {
47
48   /**
49    * Returns a core asset library array structure for this library.
50    *
51    * @param \Drupal\libraries\ExternalLibrary\LibraryManagerInterface $library_manager
52    *   The library manager that can be used to fetch dependencies.
53    *
54    * @return array
55    *
56    * @see \Drupal\libraries\ExternalLibrary\Asset\SingleAssetLibraryTrait
57    *
58    * @throws \Drupal\libraries\ExternalLibrary\Exception\InvalidLibraryDependencyException
59    *
60    * @todo Document the return value.
61    * @todo Reconsider passing the library manager.
62    */
63   public function getAttachableAssetLibrary(LibraryManagerInterface $library_manager);
64
65 }