$this->renderer->
executeInRenderContext($render_context,
function D
) use (&
$html) { // RendererInterface::render() renders the $html render array and updates
// it in place. We don't care about the return value (which is just
// $html['#markup']), but about the resulting render array.
// @todo Simplify this when https://www.drupal.org/node/2495001 lands.
$this->renderer->
render($html);
});
// RendererInterface::render() always causes bubbleable metadata to be
// stored in the render context, no need to check it conditionally.
$bubbleable_metadata =
$render_context->
pop();
$bubbleable_metadata->
applyTo($html);
$content =
$this->renderCache->
getCacheableRenderArray($html);
// Also associate the required cache contexts.
// (Because we use ::render() above and not ::renderRoot(), we manually must
// ensure the HTML response varies by the required cache contexts.)
$content['#cache'
]['contexts'
] = Cache::
mergeContexts($content['#cache'
]['contexts'
],
$this->rendererConfig
['required_cache_contexts'
]);
// Also associate the "rendered" cache tag. This allows us to invalidate the
// entire render cache, regardless of the cache bin.
$content['#cache'
]['tags'
][] = 'rendered';
$response =
new HtmlResponse($content, 200,
[