Mercurial > hg > isophonics-drupal-site
view core/lib/Drupal/Core/Render/HtmlResponse.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Core\Render; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableResponseInterface; use Drupal\Core\Cache\CacheableResponseTrait; use Symfony\Component\HttpFoundation\Response; /** * 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. * * @see \Drupal\Core\Cache\CacheableResponse * @see \Drupal\Core\Render\AttachmentsInterface * @see \Drupal\Core\Render\AttachmentsTrait */ class HtmlResponse extends Response implements CacheableResponseInterface, AttachmentsInterface { use CacheableResponseTrait; use AttachmentsTrait; /** * {@inheritdoc} */ public function setContent($content) { // A render array can automatically be converted to a string and set the // necessary metadata. if (is_array($content) && (isset($content['#markup']))) { $content += [ '#attached' => [ 'html_response_attachment_placeholders' => [], 'placeholders' => [], ], ]; $this->addCacheableDependency(CacheableMetadata::createFromRenderArray($content)); $this->setAttachments($content['#attached']); $content = $content['#markup']; } return parent::setContent($content); } }