Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

AttachmentsTrait.php

Namespace

Drupal\Core\Render

File

core/lib/Drupal/Core/Render/AttachmentsTrait.php

View source
<?php

namespace Drupal\Core\Render;


/**
 * Provides an implementation of AttachmentsInterface.
 *
 * @see \Drupal\Core\Render\AttachmentsInterface
 */
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;
    }

}

Traits

Title Deprecated Summary
AttachmentsTrait Provides an implementation of AttachmentsInterface.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal