interface AttachedAssetsInterface (View source)

The attached assets collection for the current response.

Allows for storage of:

  • an ordered list of asset libraries (to be loaded for the current response)
  • attached JavaScript settings (to be loaded for the current response)
  • a set of asset libraries that the client already has loaded (as indicated in the request, to not be loaded for the current response)

Methods

createFromRenderArray(array $render_array)

Creates an AttachedAssetsInterface object from a render array.

$this
setLibraries(array $libraries)

Sets the asset libraries attached to the current response.

string[]
getLibraries()

Returns the asset libraries attached to the current response.

$this
setSettings(array $settings)

Sets the JavaScript settings that are attached to the current response.

array
getSettings()

Returns the settings attached to the current response.

$this
setAlreadyLoadedLibraries(array $libraries)

Sets the asset libraries that the current request marked as already loaded.

string[]
getAlreadyLoadedLibraries()

Returns the set of already loaded asset libraries.

Details

static AttachedAssetsInterface createFromRenderArray(array $render_array)

Creates an AttachedAssetsInterface object from a render array.

Parameters

array $render_array

A render array.

Return Value

AttachedAssetsInterface

Exceptions

LogicException

$this setLibraries(array $libraries)

Sets the asset libraries attached to the current response.

Parameters

array $libraries

A list of libraries, in the order they should be loaded.

Return Value

$this

string[] getLibraries()

Returns the asset libraries attached to the current response.

Return Value

string[]

$this setSettings(array $settings)

Sets the JavaScript settings that are attached to the current response.

Parameters

array $settings

The needed JavaScript settings.

Return Value

$this

array getSettings()

Returns the settings attached to the current response.

Return Value

array

$this setAlreadyLoadedLibraries(array $libraries)

Sets the asset libraries that the current request marked as already loaded.

Parameters

array $libraries

The set of already loaded libraries.

Return Value

$this

string[] getAlreadyLoadedLibraries()

Returns the set of already loaded asset libraries.

Return Value

string[]