function hook_css_alter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/theme.api.php \hook_css_alter()
  2. 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_css_alter()
  3. 10 core/lib/Drupal/Core/Render/theme.api.php \hook_css_alter()
  4. 11.x 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.

See also

drupal_add_css()

drupal_get_css()

Related topics

2 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.

locale_css_alter in modules/locale/locale.module
Implements hook_css_alter().
seven_css_alter in themes/seven/template.php
Implements hook_css_alter().
1 invocation of hook_css_alter()
drupal_get_css in includes/common.inc
Returns a themed representation of all stylesheets to attach to the page.

File

modules/system/system.api.php, line 865

Code

function hook_css_alter(&$css) {
    // Remove defaults.css file.
    unset($css[drupal_get_path('module', 'system') . '/defaults.css']);
}

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