function Renderer::getCurrentRenderContext

Same name and namespace in other branches
  1. 11.x 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. 8.9.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.

File

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

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.