function AssetResolverInterface::getCssAssets

Same name in other branches
  1. 9 core/lib/Drupal/Core/Asset/AssetResolverInterface.php \Drupal\Core\Asset\AssetResolverInterface::getCssAssets()
  2. 10 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.

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/bartik/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.

1 method overrides AssetResolverInterface::getCssAssets()
AssetResolver::getCssAssets in core/lib/Drupal/Core/Asset/AssetResolver.php
Returns the CSS assets for the current response's libraries.

File

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

Class

AssetResolverInterface
Resolves asset libraries into concrete CSS and JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function getCssAssets(AttachedAssetsInterface $assets, $optimize);

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