function hook_css_alter in Drupal 8
Same name and namespace in other branches
- 7 modules/system/system.api.php \hook_css_alter()
- 9 core/lib/Drupal/Core/Render/theme.api.php \hook_css_alter()
- 10 core/lib/Drupal/Core/Render/theme.api.php \hook_css_alter()
Alter CSS files before they are output on the page.
Parameters
$css: An array of all CSS items (files and inline CSS) being requested on the page.
\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.
See also
Drupal\Core\Asset\LibraryResolverInterface::getCssAssets()
Related topics
3 functions implement hook_css_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- ckeditor_ckeditor_css_alter in core/
modules/ ckeditor/ ckeditor.module - Implements hook_ckeditor_css_alter().
- ckeditor_test_ckeditor_css_alter in core/
modules/ ckeditor/ tests/ modules/ ckeditor_test.module - Implements hook_ckeditor_css_alter().
- settings_tray_css_alter in core/
modules/ settings_tray/ settings_tray.module - Implements hook_css_alter().
1 invocation of hook_css_alter()
- 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/ Render/ theme.api.php, line 1022 - Hooks and documentation related to the theme and render system.
Code
function hook_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $assets) {
// Remove defaults.css file.
unset($css[drupal_get_path('module', 'system') . '/defaults.css']);
}