function Renderer::getCurrentRenderContext

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::getCurrentRenderContext()
  2. 10 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::getCurrentRenderContext()
  3. 11.x core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::getCurrentRenderContext()

Returns the current render context.

Return value

\Drupal\Core\Render\RenderContext The current render context.

3 calls to Renderer::getCurrentRenderContext()
Renderer::doRender in core/lib/Drupal/Core/Render/Renderer.php
See the docs for ::render().
Renderer::executeInRenderContext in core/lib/Drupal/Core/Render/Renderer.php
Executes a callable within a render context.
Renderer::hasRenderContext in core/lib/Drupal/Core/Render/Renderer.php
Checks whether a render context is active.

File

core/lib/Drupal/Core/Render/Renderer.php, line 591

Class

Renderer
Turns a render array into a HTML string.

Namespace

Drupal\Core\Render

Code

protected function getCurrentRenderContext() {
    $request = $this->requestStack
        ->getCurrentRequest();
    return isset(static::$contextCollection[$request]) ? static::$contextCollection[$request] : NULL;
}

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