Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Render / AttachmentsResponseProcessorInterface.php
1 <?php
2
3 namespace Drupal\Core\Render;
4
5 /**
6  * Defines an interface for processing attachments of responses that have them.
7  *
8  * @see \Drupal\Core\Ajax\AjaxResponse
9  * @see \Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor
10  * @see \Drupal\Core\Render\HtmlResponse
11  * @see \Drupal\Core\Render\HtmlResponseAttachmentsProcessor
12  */
13 interface AttachmentsResponseProcessorInterface {
14
15   /**
16    * Processes the attachments of a response that has attachments.
17    *
18    * Libraries, JavaScript settings, feeds, HTML <head> tags, HTML <head> links,
19    * HTTP headers, and the HTTP status code are attached to render arrays using
20    * the #attached property. The #attached property is an associative array,
21    * where the keys are the attachment types and the values are the attached
22    * data. For example:
23    *
24    * @code
25    * $build['#attached']['library'][] = [
26    *   'library' => ['core/jquery']
27    * ];
28    * $build['#attached']['http_header'] = [
29    *   ['Content-Type', 'application/rss+xml; charset=utf-8'],
30    * ];
31    * @endcode
32    *
33    * The available keys are:
34    * - 'library' (asset libraries)
35    * - 'drupalSettings' (JavaScript settings)
36    * - 'feed' (RSS feeds)
37    * - 'html_head' (tags in HTML <head>)
38    * - 'html_head_link' (<link> tags in HTML <head>)
39    * - 'http_header' (HTTP headers and status code)
40    *
41    * @param \Drupal\Core\Render\AttachmentsInterface $response
42    *   The response to process.
43    *
44    * @return \Drupal\Core\Render\AttachmentsInterface
45    *   The processed response, with the attachments updated to reflect their
46    *   final values.
47    *
48    * @throws \InvalidArgumentException
49    *   Thrown when the $response parameter is not the type of response object
50    *   the processor expects.
51    */
52   public function processAttachments(AttachmentsInterface $response);
53
54 }