4

Similar question to How can I programmatically get the theme name? and How do I programmatically change the admin theme?.

I want to simply obtain the current admin theme machine name and human name, even when I might not be on a page where the admin theme is enabled as the active theme.

This information doesn't appear to be directly accessible via the ThemeManager class.

5

This is config and you can get it with the following snippet.

$admin_theme = \Drupal::config('system.theme')->get('admin');
$admin_theme_name = \Drupal::service('theme_handler')->getName($admin_theme);

Or with Drush:

drush cget system.theme admin
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.