From 92ee8c54f106762103eec3ece0b07451fc7abe5a Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Wed, 25 Mar 2015 16:12:44 +0000 Subject: [PATCH] Issue #2458925 by alexpott: Screen is black and completely unreadable in Configure page after install on standard profile --- core/includes/install.core.inc | 20 ++++---- core/includes/theme.maintenance.inc | 9 ++-- .../Tests/Installer/StandardInstallerTest.php | 46 +++++++++++++++++++ 3 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 core/modules/system/src/Tests/Installer/StandardInstallerTest.php diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index db6d1ea20029..a6e918f0bed9 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1611,21 +1611,13 @@ function install_profile_modules(&$install_state) { * An array of information about the current installation state. */ function install_profile_themes(&$install_state) { - $theme_handler = \Drupal::service('theme_handler'); - - // ThemeHandler::install() resets the current list of themes. The theme used - // in the installer is not necessarily in the list of themes to install, so - // retain the current list. - // @see _drupal_maintenance_theme() - $current_themes = $theme_handler->listInfo(); - // Install the themes specified by the installation profile. $themes = $install_state['profile_info']['themes']; - $theme_handler->install($themes); + \Drupal::service('theme_handler')->install($themes); - foreach ($current_themes as $theme) { - $theme_handler->addTheme($theme); - } + // Ensure that the install profile's theme is used. + // @see _drupal_maintenance_theme() + \Drupal::service('theme.manager')->resetActiveTheme(); } /** @@ -1644,6 +1636,10 @@ function install_install_profile(&$install_state) { // optional configuration whose dependencies can be met at this point removes // any disparities that this creates. \Drupal::service('config.installer')->installOptionalConfig(); + + // Ensure that the install profile's theme is used. + // @see _drupal_maintenance_theme() + \Drupal::service('theme.manager')->resetActiveTheme(); } /** diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index d63ce1be6c74..16779afd1962 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -68,11 +68,10 @@ function _drupal_maintenance_theme() { // installed, retrieve all available themes. /** @var \Drupal\Core\Theme\ThemeInitialization $theme_init */ $theme_init = \Drupal::service('theme.initialization'); + $theme_handler = \Drupal::service('theme_handler'); if (empty($themes) || !isset($themes[$custom_theme])) { - $theme_handler = \Drupal::service('theme_handler'); $themes = $theme_handler->rebuildThemeData(); $theme_handler->addTheme($themes[$custom_theme]); - \Drupal::theme()->setActiveTheme($theme_init->getActiveTheme($themes[$custom_theme], array())); } // \Drupal\Core\Extension\ThemeHandlerInterface::listInfo() triggers a @@ -86,8 +85,12 @@ function _drupal_maintenance_theme() { $base_theme = array(); $ancestor = $theme; while ($ancestor && isset($themes[$ancestor]->base_theme)) { - $base_theme[] = $new_base_theme = $themes[$themes[$ancestor]->base_theme]; + $base_theme[] = $themes[$themes[$ancestor]->base_theme]; $ancestor = $themes[$ancestor]->base_theme; + if ($ancestor) { + // Ensure that the base theme is added. + $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. diff --git a/core/modules/system/src/Tests/Installer/StandardInstallerTest.php b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php new file mode 100644 index 000000000000..a19ab6c83109 --- /dev/null +++ b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php @@ -0,0 +1,46 @@ +<?php + +/** + * @file + * Contains \Drupal\system\Tests\Installer\StandardInstallerTest. + */ + +namespace Drupal\system\Tests\Installer; + +use Drupal\simpletest\InstallerTestBase; + +/** + * Tests the interactive installer installing the standard profile. + * + * @group Installer + */ +class StandardInstallerTest extends InstallerTestBase { + + /** + * {@inheritdoc} + */ + protected $profile = 'standard'; + + /** + * Ensures that the user page is available after installation. + */ + public function testInstaller() { + // Verify that the confirmation message appears. + require_once \Drupal::root() . '/core/includes/install.inc'; + $this->assertRaw(t('Congratulations, you installed @drupal!', array( + '@drupal' => drupal_install_profile_distribution_name(), + ))); + } + + /** + * {@inheritdoc} + */ + protected function setUpSite() { + // Test that the correct theme is being used. + $this->assertNoRaw('bartik'); + $this->assertRaw('themes/seven/css/theme/install-page.css'); + parent::setUpSite(); + } + + +} -- GitLab