Created
June 25, 2016 09:27
-
-
Save basvdheijden/d326609d41ca88801730cd2a473000f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$render_array = [ | |
// My render array full of items. | |
] | |
$render_context = new RenderContext(); | |
$this->renderer->executeInRenderContext($render_context, function() use (&$render_array) { | |
$this->renderer->render($render_array); | |
}); | |
$bubbleable_metadata = $render_context->pop(); | |
$bubbleable_metadata->applyTo($render_array); | |
$content = $this->renderCache->getCacheableRenderArray($render_array); | |
$content['#cache']['tags'][] = 'rendered'; | |
$response = new HtmlResponse($content, 200, [ | |
'Content-Type' => 'text/html; charset=UTF-8', | |
]); | |
return $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment