function JsCollectionRenderer::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Asset/JsCollectionRenderer.php \Drupal\Core\Asset\JsCollectionRenderer::__construct()
  2. 8.9.x 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|\Drupal\Core\Asset\AssetQueryStringInterface $asset_query_string: The asset query string.

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

\Drupal\Component\Datetime\TimeInterface|null $time: The time service.

File

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

Class

JsCollectionRenderer
Renders JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function __construct(AssetQueryStringInterface|StateInterface $asset_query_string, FileUrlGeneratorInterface $file_url_generator, ?TimeInterface $time = NULL) {
    if ($asset_query_string instanceof StateInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() with the $asset_query_string argument as \\Drupal\\Core\\State\\StateInterface instead of \\Drupal\\Core\\Asset\\AssetQueryStringInterface is deprecated in drupal:10.2.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3358337', E_USER_DEPRECATED);
        $asset_query_string = \Drupal::service('asset.query_string');
    }
    $this->assetQueryString = $asset_query_string;
    $this->fileUrlGenerator = $file_url_generator;
    if (!$time) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3387233', E_USER_DEPRECATED);
        $this->time = \Drupal::service(TimeInterface::class);
    }
}

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