You are here

interface AttachmentsResponseProcessorInterface in Drupal 8

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

Defines an interface for processing attachments of responses that have them.

Hierarchy

Expanded class hierarchy of AttachmentsResponseProcessorInterface

All classes that implement AttachmentsResponseProcessorInterface

See also

\Drupal\Core\Ajax\AjaxResponse

\Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor

\Drupal\Core\Render\HtmlResponse

\Drupal\Core\Render\HtmlResponseAttachmentsProcessor

5 files declare their use of AttachmentsResponseProcessorInterface
AjaxResponseAttachmentsProcessor.php in core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php
AjaxResponseSubscriber.php in core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php
BigPipeResponseAttachmentsProcessor.php in core/modules/big_pipe/src/Render/BigPipeResponseAttachmentsProcessor.php
BigPipeResponseAttachmentsProcessorTest.php in core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
HtmlResponseSubscriber.php in core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php

File

core/lib/Drupal/Core/Render/AttachmentsResponseProcessorInterface.php, line 13

Namespace

Drupal\Core\Render
View source
interface AttachmentsResponseProcessorInterface {

  /**
   * Processes the attachments of a response that has attachments.
   *
   * Libraries, JavaScript settings, feeds, HTML <head> tags, HTML <head> links,
   * HTTP headers, and the HTTP status code are attached to render arrays using
   * the #attached property. The #attached property is an associative array,
   * where the keys are the attachment types and the values are the attached
   * data. For example:
   *
   * @code
   * $build['#attached']['library'][] = [
   *   'library' => ['core/jquery']
   * ];
   * $build['#attached']['http_header'] = [
   *   ['Content-Type', 'application/rss+xml; charset=utf-8'],
   * ];
   * @endcode
   *
   * The available keys are:
   * - 'library' (asset libraries)
   * - 'drupalSettings' (JavaScript settings)
   * - 'feed' (RSS feeds)
   * - 'html_head' (tags in HTML <head>)
   * - 'html_head_link' (<link> tags in HTML <head>)
   * - 'http_header' (HTTP headers and status code)
   *
   * @param \Drupal\Core\Render\AttachmentsInterface $response
   *   The response to process.
   *
   * @return \Drupal\Core\Render\AttachmentsInterface
   *   The processed response, with the attachments updated to reflect their
   *   final values.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the $response parameter is not the type of response object
   *   the processor expects.
   */
  public function processAttachments(AttachmentsInterface $response);

}

Members

Namesort descending Modifiers Type Description Overrides
AttachmentsResponseProcessorInterface::processAttachments public function Processes the attachments of a response that has attachments. 2