trait AttachmentsTrait
Provides an implementation of AttachmentsInterface.
Hierarchy
- trait \Drupal\Core\Render\AttachmentsTrait
See also
\Drupal\Core\Render\AttachmentsInterface
1 file declares its use of AttachmentsTrait
- AjaxResponse.php in core/
lib/ Drupal/ Core/ Ajax/ AjaxResponse.php
File
-
core/
lib/ Drupal/ Core/ Render/ AttachmentsTrait.php, line 10
Namespace
Drupal\Core\RenderView source
trait AttachmentsTrait {
/**
* The attachments for this response.
*
* @var array
*/
protected $attachments = [];
/**
* {@inheritdoc}
*/
public function getAttachments() {
return $this->attachments;
}
/**
* {@inheritdoc}
*/
public function addAttachments(array $attachments) {
$this->attachments = BubbleableMetadata::mergeAttachments($this->attachments, $attachments);
return $this;
}
/**
* {@inheritdoc}
*/
public function setAttachments(array $attachments) {
$this->attachments = $attachments;
return $this;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
AttachmentsTrait::$attachments | protected | property | The attachments for this response. |
AttachmentsTrait::addAttachments | public | function | |
AttachmentsTrait::getAttachments | public | function | |
AttachmentsTrait::setAttachments | public | function |