function claro_system_module_invoked_library_info_alter
Same name in other branches
- 10 core/themes/claro/claro.theme \claro_system_module_invoked_library_info_alter()
- 11.x core/themes/claro/claro.theme \claro_system_module_invoked_library_info_alter()
Called by system.module via its hook_library_info_alter().
If the active theme is not Claro, but Claro is the admin theme, this alters the toolbar library config so Claro's toolbar stylesheets are used.
See also
1 call to claro_system_module_invoked_library_info_alter()
- system_library_info_alter in core/
modules/ system/ system.module - Implements hook_library_info_alter().
File
-
core/
themes/ claro/ claro.theme, line 1660
Code
function claro_system_module_invoked_library_info_alter(&$libraries, $extension) {
if ($extension === 'toolbar') {
$claro_info = \Drupal::service('theme_handler')->listInfo()['claro']->info;
$path_prefix = '/core/themes/claro/';
$claro_toolbar_overrides = $claro_info['libraries-override']['toolbar/toolbar'];
foreach ($claro_toolbar_overrides['css'] as $concern => $overrides) {
foreach ($claro_toolbar_overrides['css'][$concern] as $key => $value) {
$config = $libraries['toolbar']['css'][$concern][$key];
$libraries['toolbar']['css'][$concern][$path_prefix . $value] = $config;
unset($libraries['toolbar']['css'][$concern][$key]);
}
}
$claro_toolbar_menu_overrides = $claro_info['libraries-override']['toolbar/toolbar.menu'];
foreach ($claro_toolbar_menu_overrides['css'] as $concern => $overrides) {
foreach ($claro_toolbar_menu_overrides['css'][$concern] as $key => $value) {
$config = $libraries['toolbar.menu']['css'][$concern][$key];
$libraries['toolbar.menu']['css'][$concern][$path_prefix . $value] = $config;
unset($libraries['toolbar.menu']['css'][$concern][$key]);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.