trait AttachmentsTrait in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/AttachmentsTrait.php \Drupal\Core\Render\AttachmentsTrait
Provides an implementation of AttachmentsInterface.
Hierarchy
- trait \Drupal\Core\Render\AttachmentsTrait
See also
\Drupal\Core\Render\AttachmentsInterface
3 files declare their use of AttachmentsTrait
- AjaxResponse.php in core/
lib/ Drupal/ Core/ Ajax/ AjaxResponse.php - AttachmentsTestDomainObject.php in core/
modules/ system/ tests/ modules/ early_rendering_controller_test/ src/ AttachmentsTestDomainObject.php - AttachmentsTestResponse.php in core/
modules/ system/ tests/ modules/ early_rendering_controller_test/ src/ AttachmentsTestResponse.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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AttachmentsTrait:: |
protected | property | The attachments for this response. | |
AttachmentsTrait:: |
public | function | ||
AttachmentsTrait:: |
public | function | ||
AttachmentsTrait:: |
public | function |