You are here

public function JsCollectionRenderer::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 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;
}