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
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;