function ThemeHooks::cssAlter

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Hook/ThemeHooks.php \Drupal\admin\Hook\ThemeHooks::cssAlter()

Implements hook_css_alter().

Set admin CSS on top of all other CSS files.

Attributes

#[Hook('css_alter')]

File

core/themes/admin/src/Hook/ThemeHooks.php, line 54

Class

ThemeHooks
Provides theme related hook implementations.

Namespace

Drupal\admin\Hook

Code

public function cssAlter(array &$css) : void {
  // Use anything greater than 100 to have it load after the theme as
  // CSS_AGGREGATE_THEME is set to 100. Let's be on the safe side and assign a
  // high number to it.
  $base_css = $this->themeExtensionList
    ->getPath('admin') . '/migration/css/base/gin.css';
  if (isset($css[$base_css])) {
    $css[$base_css]['group'] = 200;
  }
  // The gin-custom.css file should be loaded just after our gin.css file.
  $custom_css = 'public://admin-custom.css';
  if (isset($css[$custom_css])) {
    $css[$custom_css]['group'] = 201;
  }
}

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