diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index b98d28a..6224854 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -82,19 +82,19 @@ function _drupal_maintenance_theme() { $theme = $custom_theme; // Find all our ancestor themes and put them in an array. - $base_theme = array(); + $base_themes = array(); $ancestor = $theme; while ($ancestor && isset($themes[$ancestor]->base_theme)) { - $base_theme[] = $themes[$themes[$ancestor]->base_theme]; + $base_themes[] = $themes[$themes[$ancestor]->base_theme]; $ancestor = $themes[$ancestor]->base_theme; if ($ancestor) { - // Ensure that the base theme is added. + // Ensure that the base theme is added and installed. $theme_handler->addTheme($themes[$ancestor]); } } // @todo This is just a workaround. Find a better way how to handle themes // on maintenance pages, see https://www.drupal.org/node/2322619. - \Drupal::theme()->setActiveTheme($theme_init->getActiveTheme($themes[$custom_theme], array_reverse($base_theme))); + \Drupal::theme()->setActiveTheme($theme_init->getActiveTheme($themes[$custom_theme], $base_themes)); // Prime the theme registry. Drupal::service('theme.registry'); } diff --git a/core/lib/Drupal/Core/Theme/ThemeInitializationInterface.php b/core/lib/Drupal/Core/Theme/ThemeInitializationInterface.php index cd5c1be..a3b54df 100644 --- a/core/lib/Drupal/Core/Theme/ThemeInitializationInterface.php +++ b/core/lib/Drupal/Core/Theme/ThemeInitializationInterface.php @@ -57,8 +57,8 @@ public function loadActiveTheme(ActiveTheme $active_theme); * @param \Drupal\Core\Extension\Extension $theme * The theme extension object. * @param \Drupal\Core\Extension\Extension[] $base_themes - * An array of extension objects of base theme and its bases. It is ordered - * by 'oldest first', meaning the top level of the chain will be first. + * An array of extension objects of base theme and its bases. It is ordered + * by 'next parent first', meaning the top level of the chain will be first. * * @return \Drupal\Core\Theme\ActiveTheme * The active theme instance for the passed in $theme. diff --git a/core/modules/system/src/Tests/Installer/InstallerThemeTest.php b/core/modules/system/src/Tests/Installer/InstallerThemeTest.php new file mode 100644 index 0000000..ffed969 --- /dev/null +++ b/core/modules/system/src/Tests/Installer/InstallerThemeTest.php @@ -0,0 +1,45 @@ +settingsSet('maintenance_theme', 'seven'); + // Get the maintenance theme loaded. + drupal_maintenance_theme(); + // Do we have an active + $this->assertTrue(\Drupal::theme()->hasActiveTheme()); + + $active_theme = \Drupal::theme()->getActiveTheme(); + $this->assertEqual($active_theme->getName(), 'seven', 'Active maintenance theme is Seven'); + $base_themes = $active_theme->getBaseThemes(); + $base_theme_names = array_keys($base_themes); + // Ensure count and order are correct. + $this->assertTrue(count($base_themes) === 2); + $this->assertEqual($base_theme_names[0], 'classy', 'Classy is the base theme of Seven'); + $this->assertEqual($base_theme_names[1], 'stable', 'Stable is the parent of Classy'); + // Ensure base theme's have proper base themes and the right count. + $classy_base_themes = $base_themes['classy']->getBaseThemes(); + $this->assertTrue(count($classy_base_themes) === 1); + $this->assertTrue(isset($classy_base_themes['stable'])); + } + +} diff --git a/core/modules/system/src/Tests/Installer/StandardInstallerTest.php b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php index 184e07b..9519d7d 100644 --- a/core/modules/system/src/Tests/Installer/StandardInstallerTest.php +++ b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php @@ -41,6 +41,20 @@ protected function setUpSite() { } /** + * {@inheritdoc} + */ + protected function curlExec($curl_options, $redirect = FALSE) { + if ($redirect) { + // Ensure that we see the classy progress css on the page. + if (strpos($curl_options[CURLOPT_URL], 'do_nojs') !== FALSE) { + $this->assertRaw('themes/classy/css/components/progress.css'); + } + } + + return parent::curlExec($curl_options, $redirect); + } + + /** * Ensures that the exported standard configuration is up to date. */ public function testStandardConfig() {