function JsCollectionRenderer::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Asset/JsCollectionRenderer.php \Drupal\Core\Asset\JsCollectionRenderer::__construct()
  2. 10 core/lib/Drupal/Core/Asset/JsCollectionRenderer.php \Drupal\Core\Asset\JsCollectionRenderer::__construct()
  3. 11.x core/lib/Drupal/Core/Asset/JsCollectionRenderer.php \Drupal\Core\Asset\JsCollectionRenderer::__construct()

Constructs a JsCollectionRenderer.

Parameters

\Drupal\Core\State\StateInterface $state: The state key/value store.

\Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator: The file URL generator.

File

core/lib/Drupal/Core/Asset/JsCollectionRenderer.php, line 36

Class

JsCollectionRenderer
Renders JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function __construct(StateInterface $state, FileUrlGeneratorInterface $file_url_generator = NULL) {
    $this->state = $state;
    if (!$file_url_generator) {
        @trigger_error('Calling JsCollectionRenderer::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0. The $file_url_generator argument will be required in drupal:10.0.0. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
        $file_url_generator = \Drupal::service('file_url_generator');
    }
    $this->fileUrlGenerator = $file_url_generator;
}

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