function ToolbarThemeHooks::themeRegistryAlter
Same name and namespace in other branches
- main core/modules/toolbar/src/Hook/ToolbarThemeHooks.php \Drupal\toolbar\Hook\ToolbarThemeHooks::themeRegistryAlter()
Implements hook_theme_registry_alter().
Attributes
#[Hook('theme_registry_alter')]
File
-
core/
modules/ toolbar/ src/ Hook/ ToolbarThemeHooks.php, line 178
Class
- ToolbarThemeHooks
- Hook implementations for toolbar.
Namespace
Drupal\toolbar\HookCode
public function themeRegistryAlter(array &$theme_registry) : void {
// If Claro is the admin theme but not the active theme, use Claro's toolbar
// templates.
if ($this->isClaroAdminAndNotActive()) {
// If the active theme is not Claro, but Claro is the admin theme, this
// alters the registry so Claro's toolbar templates are used.
foreach ([
'toolbar',
'menu__toolbar',
] as $registry_item) {
if (isset($theme_registry[$registry_item])) {
$theme_registry[$registry_item]['path'] = 'core/themes/claro/templates/navigation';
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.