HtmlResponse
class HtmlResponse extends Response implements CacheableResponseInterface, AttachmentsInterface (View source)
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
Constructs a HtmlResponse object.
Sets the response content.
Details
addCacheableDependency($dependency)
{@inheritdoc}
getCacheableMetadata()
{@inheritdoc}
getAttachments()
{@inheritdoc}
addAttachments(array $attachments)
{@inheritdoc}
setAttachments(array $attachments)
{@inheritdoc}
__construct(array|string $content = '', int $status = 200, array $headers = [])
Constructs a HtmlResponse object.
$this
setContent(mixed $content)
Sets the response content.