summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-24 06:14:02 (GMT)
committerNathaniel Catchpole2016-02-24 06:14:02 (GMT)
commitf33b2415bb30137df82df16731ca5fe535db1b96 (patch)
treed26c6681c3009e5ed02f811fa7f56fb6c1030e39
parent45689e4b8f4e3f9fcbf13de25dd237cb4041a3c2 (diff)
Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy, ravi.khetri, jyotisankar, sudhanshug, jaredsmith, nesta_: Disable themes when theme engine or base theme aren't available
-rw-r--r--core/modules/system/src/Controller/SystemController.php4
-rw-r--r--core/modules/system/src/Tests/System/ThemeTest.php4
-rw-r--r--core/modules/system/tests/themes/test_invalid_basetheme_sub/test_invalid_basetheme_sub.info.yml6
3 files changed, 12 insertions, 2 deletions
diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php
index 84e6ac5..9829181 100644
--- a/core/modules/system/src/Controller/SystemController.php
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -245,8 +245,8 @@ class SystemController extends ControllerBase {
// content has a common place in all themes.
$theme->incompatible_region = !isset($theme->info['regions']['content']);
$theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0;
- // Confirmed that the base theme is available.
- $theme->incompatible_base = isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]);
+ // Confirm that all base themes are available.
+ $theme->incompatible_base = (isset($theme->info['base theme']) && !($theme->base_themes === array_filter($theme->base_themes)));
// Confirm that the theme engine is available.
$theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner);
}
diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php
index c2f5a57..bea4e39 100644
--- a/core/modules/system/src/Tests/System/ThemeTest.php
+++ b/core/modules/system/src/Tests/System/ThemeTest.php
@@ -319,6 +319,9 @@ class ThemeTest extends WebTestBase {
/**
* Test themes can't be installed when the base theme or engine is missing.
+ *
+ * Include test for themes that have a missing base theme somewhere further up
+ * the chain than the immediate base theme.
*/
function testInvalidTheme() {
// theme_page_test_system_info_alter() un-hides all hidden themes.
@@ -327,6 +330,7 @@ class ThemeTest extends WebTestBase {
$this->container->get('theme_handler')->reset();
$this->drupalGet('admin/appearance');
$this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'not_real_test_basetheme')));
+ $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => 'test_invalid_basetheme')));
$this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => 'not_real_engine')));
// Check for the error text of a theme with the wrong core version.
$this->assertText("This theme is not compatible with Drupal 8.x. Check that the .info.yml file contains the correct 'core' value.");
diff --git a/core/modules/system/tests/themes/test_invalid_basetheme_sub/test_invalid_basetheme_sub.info.yml b/core/modules/system/tests/themes/test_invalid_basetheme_sub/test_invalid_basetheme_sub.info.yml
new file mode 100644
index 0000000..7b00c1b
--- /dev/null
+++ b/core/modules/system/tests/themes/test_invalid_basetheme_sub/test_invalid_basetheme_sub.info.yml
@@ -0,0 +1,6 @@
+name: 'Theme test with valid base theme but no grandparent base theme'
+type: theme
+description: 'Test theme which has a non-existent base theme in the base chain.'
+version: VERSION
+core: 8.x
+base theme: test_invalid_basetheme