function AssetResolverInterface::getCssAssets

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

Returns the CSS assets for the current response's libraries.

It returns the CSS assets in order, according to the SMACSS categories specified in the assets' weights:

Parameters

\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.

bool $optimize: Whether to apply the CSS asset collection optimizer, to return an optimized CSS asset collection rather than an unoptimized one.

\Drupal\Core\Language\LanguageInterface $language: (optional) The interface language the assets will be rendered with.

Return value

array A (possibly optimized) collection of CSS assets.

See also

https://www.drupal.org/node/1887918#separate-concerns This ensures proper cascading of styles so themes can easily override module styles through CSS selectors.

Themes may replace module-defined CSS files by adding a stylesheet with the same filename. For example, themes/olivero/system-menus.css would replace modules/system/system-menus.css. This allows themes to override complete CSS files, rather than specific selectors, when necessary.

Also invokes hook_css_alter(), to allow CSS assets to be altered.

File

core/lib/Drupal/Core/Asset/AssetResolverInterface.php, line 54

Class

AssetResolverInterface
Resolves asset libraries into concrete CSS and JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function getCssAssets(AttachedAssetsInterface $assets, $optimize, ?LanguageInterface $language = NULL);

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