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