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)?

1 Answer 1


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;

Your Answer

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

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