function Renderer::getCurrentRenderContext

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::getCurrentRenderContext()
  2. 8.9.x 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|null 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
Renderer::hasRenderContext in core/lib/Drupal/Core/Render/Renderer.php

File

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

Class

Renderer
Turns a render array into an HTML string.

Namespace

Drupal\Core\Render

Code

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

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