class HtmlResponse extends Response implements CacheableResponseInterface, AttachmentsInterface (View source)

A response that contains and can expose cacheability metadata and attachments.

Supports Drupal's caching concepts: cache tags for invalidation and cache contexts for variations.

Supports Drupal's idea of #attached metadata: libraries, settings, http_header and html_head.

Traits

Provides an implementation of CacheableResponseInterface.

Provides an implementation of AttachmentsInterface.

Properties

protected CacheableMetadata $cacheabilityMetadata

The cacheability metadata.

from  CacheableResponseTrait
protected array $attachments

The attachments for this response.

from  AttachmentsTrait

Methods

addCacheableDependency($dependency)

{@inheritdoc}

getAttachments()

{@inheritdoc}

addAttachments(array $attachments)

{@inheritdoc}

setAttachments(array $attachments)

{@inheritdoc}

setContent($content)

{@inheritdoc}

Details

addCacheableDependency($dependency)

{@inheritdoc}

Parameters

$dependency

getCacheableMetadata()

{@inheritdoc}

getAttachments()

{@inheritdoc}

addAttachments(array $attachments)

{@inheritdoc}

Parameters

array $attachments

setAttachments(array $attachments)

{@inheritdoc}

Parameters

array $attachments

setContent($content)

{@inheritdoc}

Parameters

$content