comparison core/lib/Drupal/Core/Render/AttachmentsTrait.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Render;
4
5 /**
6 * Provides an implementation of AttachmentsInterface.
7 *
8 * @see \Drupal\Core\Render\AttachmentsInterface
9 */
10 trait AttachmentsTrait {
11
12 /**
13 * The attachments for this response.
14 *
15 * @var array
16 */
17 protected $attachments = [];
18
19 /**
20 * {@inheritdoc}
21 */
22 public function getAttachments() {
23 return $this->attachments;
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function addAttachments(array $attachments) {
30 $this->attachments = BubbleableMetadata::mergeAttachments($this->attachments, $attachments);
31 return $this;
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function setAttachments(array $attachments) {
38 $this->attachments = $attachments;
39 return $this;
40 }
41
42 }