In an admin settings form in a custom module, I need to determine what base themes a specific theme uses (the default theme, not the current theme). If I know the child theme's name, how do I obtain the names of the 'base themes' that child theme uses (if any)?

2 Answers 2


You can get the details of a theme by using ThemeHandler::listInfo().

$child_theme = 'bartik';

$base_theme = \Drupal::service('theme_handler')->listInfo()[$child_theme]->base_theme;

$base_themes = \Drupal::service('theme_handler')->listInfo()[$child_theme]->base_themes;

As of 2018, you can now get the base theme by inspecting the active theme's extensions: https://www.drupal.org/node/3019948

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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