function RendererInterface::renderRoot

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/RendererInterface.php \Drupal\Core\Render\RendererInterface::renderRoot()
  2. 8.9.x core/lib/Drupal/Core/Render/RendererInterface.php \Drupal\Core\Render\RendererInterface::renderRoot()
  3. 10 core/lib/Drupal/Core/Render/RendererInterface.php \Drupal\Core\Render\RendererInterface::renderRoot()

Renders final HTML given a structured array tree.

Calls ::render() in such a way that placeholders are replaced.

Should therefore only be used in occasions where the final rendering is happening, just before sending a Response:

  • system internals that are responsible for rendering the final HTML
  • render arrays for non-HTML responses, such as feeds

(Cannot be executed within another render context.)

Parameters

array $elements: The structured array describing the data to be rendered.

Return value

\Drupal\Component\Render\MarkupInterface The rendered HTML.

Throws

\LogicException When called from inside another renderRoot() call.

See also

\Drupal\Core\Render\RendererInterface::render()

1 method overrides RendererInterface::renderRoot()
Renderer::renderRoot in core/lib/Drupal/Core/Render/Renderer.php
Renders final HTML given a structured array tree.

File

core/lib/Drupal/Core/Render/RendererInterface.php, line 33

Class

RendererInterface
Defines an interface for turning a render array into a string.

Namespace

Drupal\Core\Render

Code

public function renderRoot(&$elements);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.