Renderer::$contextCollection

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::contextCollection
  2. 8.9.x core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::contextCollection
  3. 11.x core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::contextCollection

The render context collection.

An individual global render context is tied to the current request. We then need to maintain a different context for each request to correctly handle rendering in subrequests.

This must be static as long as some controllers rebuild the container during a request. This causes multiple renderer instances to co-exist simultaneously, render state getting lost, and therefore causing pages to fail to render correctly. As soon as it is guaranteed that during a request the same container is used, it no longer needs to be static.

Type: \Drupal\Core\Render\RenderContext[]

File

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

Class

Renderer
Turns a render array into an HTML string.

Namespace

Drupal\Core\Render

Code

protected static $contextCollection;

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