function Renderer::__construct

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

Constructs a new Renderer.

Parameters

\Drupal\Core\Utility\CallableResolver $callableResolver: The callable resolver.

\Drupal\Core\Theme\ThemeManagerInterface $theme: The theme manager.

\Drupal\Core\Render\ElementInfoManagerInterface $elementInfo: The element info.

\Drupal\Core\Render\PlaceholderGeneratorInterface $placeholderGenerator: The placeholder generator.

\Drupal\Core\Render\RenderCacheInterface $renderCache: The render cache service.

\Symfony\Component\HttpFoundation\RequestStack $requestStack: The request stack.

array $renderer_config: The renderer configuration array.

File

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

Class

Renderer
Turns a render array into an HTML string.

Namespace

Drupal\Core\Render

Code

public function __construct(protected CallableResolver $callableResolver, protected ThemeManagerInterface $theme, protected ElementInfoManagerInterface $elementInfo, protected PlaceholderGeneratorInterface $placeholderGenerator, protected RenderCacheInterface $renderCache, protected RequestStack $requestStack, array $renderer_config) {
  if (!isset($renderer_config['debug'])) {
    $renderer_config['debug'] = FALSE;
  }
  $this->rendererConfig = $renderer_config;
  // Initialize the context collection if needed.
  if (!isset(static::$contextCollection)) {
    static::$contextCollection = new \SplObjectStorage();
  }
}

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