Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Render/AttachmentsInterface.php \Drupal\Core\Render\AttachmentsInterface
  2. 9 core/lib/Drupal/Core/Render/AttachmentsInterface.php \Drupal\Core\Render\AttachmentsInterface

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

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

Hierarchy

Expanded class hierarchy of AttachmentsInterface

All classes that implement AttachmentsInterface

See also

\Drupal\Core\Render\AttachmentsTrait

11 files declare their use of AttachmentsInterface
AjaxResponse.php in core/lib/Drupal/Core/Ajax/AjaxResponse.php
AjaxResponseAttachmentsProcessor.php in core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.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
BigPipeResponseAttachmentsProcessor.php in core/modules/big_pipe/src/Render/BigPipeResponseAttachmentsProcessor.php

... See full list

File

core/lib/Drupal/Core/Render/AttachmentsInterface.php, line 14

Namespace

Drupal\Core\Render
View source
interface AttachmentsInterface {

  /**
   * Gets attachments.
   *
   * @return array
   *   The attachments.
   */
  public function getAttachments();

  /**
   * Adds attachments.
   *
   * @param array $attachments
   *   The attachments to add.
   *
   * @return $this
   */
  public function addAttachments(array $attachments);

  /**
   * Sets attachments.
   *
   * @param array $attachments
   *   The attachments to set.
   *
   * @return $this
   */
  public function setAttachments(array $attachments);

}

Members

Namesort descending Modifiers Type Description Overrides
AttachmentsInterface::addAttachments public function Adds attachments.
AttachmentsInterface::getAttachments public function Gets attachments.
AttachmentsInterface::setAttachments public function Sets attachments.