function CssCollectionRenderer::__construct

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

Constructs a CssCollectionRenderer.

Parameters

\Drupal\Core\Asset\AssetQueryStringInterface|\Drupal\Core\State\StateInterface $asset_query_string: The asset query string.

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

File

core/lib/Drupal/Core/Asset/CssCollectionRenderer.php, line 43

Class

CssCollectionRenderer
Renders CSS assets.

Namespace

Drupal\Core\Asset

Code

public function __construct(AssetQueryStringInterface|StateInterface $asset_query_string, FileUrlGeneratorInterface $file_url_generator) {
    if ($asset_query_string instanceof StateInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() with an $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;
}

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