Skip to content
Snippets Groups Projects
Commit 74b5ae9b authored by Purencool's avatar Purencool
Browse files

#3437099 made sure the css file is loaded below the theme.

parent 468fe7e1
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\browser_development_assist\Processing\FileSystemStructure; use Drupal\browser_development_assist\Processing\FileSystemStructure;
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Asset\AttachedAssetsInterface;
/** /**
* Implements hook_help(). * Implements hook_help().
...@@ -27,20 +28,6 @@ function browser_development_assist_help($route_name, RouteMatchInterface $route ...@@ -27,20 +28,6 @@ function browser_development_assist_help($route_name, RouteMatchInterface $route
} }
} }
/**
* Implements hook_page_attachments().
*/
function browser_development_assist_page_attachments(array &$page) {
// Attaching library to theme
$active = \Drupal::theme()->getActiveTheme()->getName();
$current_theme = \Drupal::config('system.theme')->get('default');
if ($active === $current_theme) {
$page['#attached']['library'][] = 'browser_development_assist/browser-development-assist';
}
}
/** /**
* Implements hook_library_info_build(). * Implements hook_library_info_build().
*/ */
...@@ -53,10 +40,43 @@ function browser_development_assist_library_info_build() { ...@@ -53,10 +40,43 @@ function browser_development_assist_library_info_build() {
'version' => 'VERSION', 'version' => 'VERSION',
'css' => [ 'css' => [
'theme' => [ 'theme' => [
"$css" => ['weight' => '100'] "$css" => []
] ]
], ],
], ],
]; ];
} }
/**
* Attaches
*
* Implements hook_page_attachments().
*/
function browser_development_assist_page_attachments(array &$page) {
// Attaching library to theme
$active = \Drupal::theme()->getActiveTheme()->getName();
$current_theme = \Drupal::config('system.theme')->get('default');
if ($active === $current_theme) {
$page['#attached']['library'][] = 'browser_development_assist/browser-development-assist';
}
}
/**
* Implements hook_css_alter().
*/
function browser_development_assist_css_alter(&$css, AttachedAssetsInterface $assets) {
$library = \Drupal::service('library.discovery')
->getLibraryByName('browser_development_assist', 'browser-development-assist');
$path = $library['css'][0]['data'];
if (isset($css[$path])) {
$css[$path]['group'] = 300;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment