boilerplate module to be cloned for inserting css/js overrides in sites where a whole sub-theme maybe overkill
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Primary module hooks for theme_overrides module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
use Drupal\Core\Asset\AttachedAssetsInterface;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_css_alter().
|
|
|
|
*/
|
|
|
|
function theme_overrides_css_alter(&$css, AttachedAssetsInterface $assets) {
|
|
|
|
|
|
|
|
$library = \Drupal::service('library.discovery')->getLibraryByName('theme_overrides', 'global');
|
|
|
|
$path = $library['css'][0]['data'];
|
|
|
|
|
|
|
|
if (isset($css[$path])) {
|
|
|
|
$css[$path]['group'] = 300;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function theme_overrides_page_attachments(&$variables) {
|
|
|
|
$variables['#attached']['library'][] = 'theme_overrides/global';
|
|
|
|
}
|