annotate core/lib/Drupal/Core/Asset/AttachedAssetsInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Asset;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * The attached assets collection for the current response.
Chris@0 7 *
Chris@0 8 * Allows for storage of:
Chris@0 9 * - an ordered list of asset libraries (to be loaded for the current response)
Chris@0 10 * - attached JavaScript settings (to be loaded for the current response)
Chris@0 11 * - a set of asset libraries that the client already has loaded (as indicated
Chris@0 12 * in the request, to *not* be loaded for the current response)
Chris@0 13 *
Chris@0 14 * @see \Drupal\Core\Asset\AssetResolverInterface
Chris@0 15 */
Chris@0 16 interface AttachedAssetsInterface {
Chris@0 17
Chris@0 18 /**
Chris@0 19 * Creates an AttachedAssetsInterface object from a render array.
Chris@0 20 *
Chris@0 21 * @param array $render_array
Chris@0 22 * A render array.
Chris@0 23 *
Chris@0 24 * @return \Drupal\Core\Asset\AttachedAssetsInterface
Chris@0 25 *
Chris@0 26 * @throws \LogicException
Chris@0 27 */
Chris@0 28 public static function createFromRenderArray(array $render_array);
Chris@0 29
Chris@0 30 /**
Chris@0 31 * Sets the asset libraries attached to the current response.
Chris@0 32 *
Chris@0 33 * @param string[] $libraries
Chris@0 34 * A list of libraries, in the order they should be loaded.
Chris@0 35 *
Chris@0 36 * @return $this
Chris@0 37 */
Chris@0 38 public function setLibraries(array $libraries);
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Returns the asset libraries attached to the current response.
Chris@0 42 *
Chris@0 43 * @return string[]
Chris@0 44 */
Chris@0 45 public function getLibraries();
Chris@0 46
Chris@0 47 /**
Chris@0 48 * Sets the JavaScript settings that are attached to the current response.
Chris@0 49 *
Chris@0 50 * @param array $settings
Chris@0 51 * The needed JavaScript settings.
Chris@0 52 *
Chris@0 53 * @return $this
Chris@0 54 */
Chris@0 55 public function setSettings(array $settings);
Chris@0 56
Chris@0 57 /**
Chris@0 58 * Returns the settings attached to the current response.
Chris@0 59 *
Chris@0 60 * @return array
Chris@0 61 */
Chris@0 62 public function getSettings();
Chris@0 63
Chris@0 64 /**
Chris@0 65 * Sets the asset libraries that the current request marked as already loaded.
Chris@0 66 *
Chris@0 67 * @param string[] $libraries
Chris@0 68 * The set of already loaded libraries.
Chris@0 69 *
Chris@0 70 * @return $this
Chris@0 71 */
Chris@0 72 public function setAlreadyLoadedLibraries(array $libraries);
Chris@0 73
Chris@0 74 /**
Chris@0 75 * Returns the set of already loaded asset libraries.
Chris@0 76 *
Chris@0 77 * @return string[]
Chris@0 78 */
Chris@0 79 public function getAlreadyLoadedLibraries();
Chris@0 80
Chris@0 81 }