By alexpott on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.7.x
Introduced in version:
8.7.0
Issue links:
Description:
Drupal\Core\Theme\ActiveTheme::getBaseThemes() is deprecated. You can no longer directly get the ActiveTheme representations of the current ActiveTheme's base themes from it.
Before
$active_theme = \Drupal::theme()->getActiveTheme();
foreach ($active_theme->getBaseThemes() as $base_theme) {
$engine = $base_theme->getEngine();
}
After
$active_theme = \Drupal::theme()->getActiveTheme();
foreach ($active_theme->getBaseThemeExtensions() as $base_theme) {
$base_active_theme = \Drupal::service('theme.initialization')->getActiveThemeByName($base_theme->getName());
$engine = $base_theme->getEngine();
}
Note that the active theme representation is rarely (if ever needed) and the new method \Drupal\Core\Theme\ActiveTheme::getBaseThemeExtensions() returns \Drupal\Core\Extension\Extension objects for each base theme.
Impacts:
Module developers