3 namespace Drupal\Core\Asset;
6 * The attached assets collection for the current response.
8 * Allows for storage of:
9 * - an ordered list of asset libraries (to be loaded for the current response)
10 * - attached JavaScript settings (to be loaded for the current response)
11 * - a set of asset libraries that the client already has loaded (as indicated
12 * in the request, to *not* be loaded for the current response)
14 * @see \Drupal\Core\Asset\AssetResolverInterface
16 interface AttachedAssetsInterface {
19 * Creates an AttachedAssetsInterface object from a render array.
21 * @param array $render_array
24 * @return \Drupal\Core\Asset\AttachedAssetsInterface
26 * @throws \LogicException
28 public static function createFromRenderArray(array $render_array);
31 * Sets the asset libraries attached to the current response.
33 * @param string[] $libraries
34 * A list of libraries, in the order they should be loaded.
38 public function setLibraries(array $libraries);
41 * Returns the asset libraries attached to the current response.
45 public function getLibraries();
48 * Sets the JavaScript settings that are attached to the current response.
50 * @param array $settings
51 * The needed JavaScript settings.
55 public function setSettings(array $settings);
58 * Returns the settings attached to the current response.
62 public function getSettings();
65 * Sets the asset libraries that the current request marked as already loaded.
67 * @param string[] $libraries
68 * The set of already loaded libraries.
72 public function setAlreadyLoadedLibraries(array $libraries);
75 * Returns the set of already loaded asset libraries.
79 public function getAlreadyLoadedLibraries();