You are here

public function Renderer::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::__construct()

Constructs a new Renderer.

Parameters

\Drupal\Core\Controller\ControllerResolverInterface $controller_resolver: The controller resolver.

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

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

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

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

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

array $renderer_config: The renderer configuration array.

File

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

Class

Renderer
Turns a render array into an HTML string.

Namespace

Drupal\Core\Render

Code

public function __construct(ControllerResolverInterface $controller_resolver, ThemeManagerInterface $theme, ElementInfoManagerInterface $element_info, PlaceholderGeneratorInterface $placeholder_generator, RenderCacheInterface $render_cache, RequestStack $request_stack, array $renderer_config) {
  $this->controllerResolver = $controller_resolver;
  $this->theme = $theme;
  $this->elementInfo = $element_info;
  $this->placeholderGenerator = $placeholder_generator;
  $this->renderCache = $render_cache;
  $this->rendererConfig = $renderer_config;
  $this->requestStack = $request_stack;

  // Initialize the context collection if needed.
  if (!isset(static::$contextCollection)) {
    static::$contextCollection = new \SplObjectStorage();
  }
}