interface AttachmentsInterface (View source)

Defines an interface for responses that can expose #attached metadata.

If in Drupal 9, we remove attachments other than assets (libraries + drupalSettings), then we can look into unifying this with \Drupal\Core\Asset\AttachedAssetsInterface.

Methods

array
getAttachments()

Gets attachments.

$this
addAttachments(array $attachments)

Adds attachments.

$this
setAttachments(array $attachments)

Sets attachments.

Details

array getAttachments()

Gets attachments.

Return Value

array

The attachments.

$this addAttachments(array $attachments)

Adds attachments.

Parameters

array $attachments

The attachments to add.

Return Value

$this

$this setAttachments(array $attachments)

Sets attachments.

Parameters

array $attachments

The attachments to set.

Return Value

$this