function Renderer::render
Same name in other branches
- 9 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::render()
- 8.9.x core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::render()
- 11.x core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::render()
2 calls to Renderer::render()
- Renderer::renderInIsolation in core/
lib/ Drupal/ Core/ Render/ Renderer.php - Renderer::renderRoot in core/
lib/ Drupal/ Core/ Render/ Renderer.php
File
-
core/
lib/ Drupal/ Core/ Render/ Renderer.php, line 235
Class
- Renderer
- Turns a render array into an HTML string.
Namespace
Drupal\Core\RenderCode
public function render(&$elements, $is_root_call = FALSE) {
// Since #pre_render, #post_render, #lazy_builder callbacks and theme
// functions or templates may be used for generating a render array's
// content, and we might be rendering the main content for the page, it is
// possible that any of them throw an exception that will cause a different
// page to be rendered (e.g. throwing
// \Symfony\Component\HttpKernel\Exception\NotFoundHttpException will cause
// the 404 page to be rendered). That page might also use
// Renderer::renderRoot() but if exceptions aren't caught here, it will be
// impossible to call Renderer::renderRoot() again.
// Hence, catch all exceptions, reset the isRenderingRoot property and
// re-throw exceptions.
try {
return $this->doRender($elements, $is_root_call);
} catch (\Exception $e) {
// Mark the ::rootRender() call finished due to this exception & re-throw.
$this->isRenderingRoot = FALSE;
throw $e;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.