Issue #2614014 by joelpittet, alexpott, dawehner, Cottser, LewisNyman: Progress bar, fieldsets, messages broken in the installer due to theme ordering bug
parent
99507a38ce
commit
f8ef22c453
|
@ -82,19 +82,21 @@ function _drupal_maintenance_theme() {
|
|||
$theme = $custom_theme;
|
||||
|
||||
// Find all our ancestor themes and put them in an array.
|
||||
$base_theme = array();
|
||||
// @todo This is just a workaround. Find a better way how to handle themes
|
||||
// on maintenance pages, see https://www.drupal.org/node/2322619.
|
||||
// This code is basically a duplicate of
|
||||
// \Drupal\Core\Theme\ThemeInitialization::getActiveThemeByName.
|
||||
$base_themes = [];
|
||||
$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');
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ interface ThemeInitializationInterface {
|
|||
* @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.
|
||||
|
|
|
@ -40,6 +40,19 @@ class StandardInstallerTest extends ConfigAfterInstallerTestBase {
|
|||
parent::setUpSite();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function curlExec($curl_options, $redirect = FALSE) {
|
||||
// Ensure that we see the classy progress CSS on the batch page.
|
||||
// Batch processing happens as part of HTTP redirects, so we can access the
|
||||
// HTML of the batch page.
|
||||
if (strpos($curl_options[CURLOPT_URL], '&id=1&op=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.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\KernelTests\Core\Theme\MaintenanceThemeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\KernelTests\Core\Theme;
|
||||
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests themes and base themes are correctly loaded.
|
||||
*
|
||||
* @group Installer
|
||||
*/
|
||||
class MaintenanceThemeTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Tests that the maintenance theme initializes the theme and its base themes.
|
||||
*/
|
||||
public function testMaintenanceTheme() {
|
||||
$this->setSetting('maintenance_theme', 'seven');
|
||||
// Get the maintenance theme loaded.
|
||||
drupal_maintenance_theme();
|
||||
|
||||
// Do we have an active theme?
|
||||
$this->assertTrue(\Drupal::theme()->hasActiveTheme());
|
||||
|
||||
$active_theme = \Drupal::theme()->getActiveTheme();
|
||||
$this->assertEquals('seven', $active_theme->getName());
|
||||
|
||||
$base_themes = $active_theme->getBaseThemes();
|
||||
$base_theme_names = array_keys($base_themes);
|
||||
$this->assertSame(['classy', 'stable'], $base_theme_names);
|
||||
|
||||
// Ensure Classy has the correct base themes and amount of base themes.
|
||||
$classy_base_themes = $base_themes['classy']->getBaseThemes();
|
||||
$classy_base_theme_names = array_keys($classy_base_themes);
|
||||
$this->assertSame(['stable'], $classy_base_theme_names);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue