function AjaxRenderer::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php \Drupal\Core\Render\MainContent\AjaxRenderer::__construct()
  2. 10 core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php \Drupal\Core\Render\MainContent\AjaxRenderer::__construct()
  3. 11.x core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php \Drupal\Core\Render\MainContent\AjaxRenderer::__construct()

Constructs a new AjaxRenderer instance.

Parameters

\Drupal\Core\Render\ElementInfoManagerInterface $element_info_manager: The element info manager.

\Drupal\Core\Render\RendererInterface $renderer: The renderer.

File

core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php, line 41

Class

AjaxRenderer
Default main content renderer for Ajax requests.

Namespace

Drupal\Core\Render\MainContent

Code

public function __construct(ElementInfoManagerInterface $element_info_manager, RendererInterface $renderer = NULL) {
    $this->elementInfoManager = $element_info_manager;
    if ($renderer === NULL) {
        @trigger_error('The renderer service must be passed to ' . __METHOD__ . ' and will be required before Drupal 9.0.0. See https://www.drupal.org/node/3009400', E_USER_DEPRECATED);
        $renderer = \Drupal::service('renderer');
    }
    $this->renderer = $renderer;
}

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