Skip to content
Snippets Groups Projects
Commit f33b2415 authored by catch's avatar catch
Browse files

Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

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
parent 45689e4b
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -245,8 +245,8 @@ public function themesPage() { ...@@ -245,8 +245,8 @@ public function themesPage() {
// content has a common place in all themes. // content has a common place in all themes.
$theme->incompatible_region = !isset($theme->info['regions']['content']); $theme->incompatible_region = !isset($theme->info['regions']['content']);
$theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0; $theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0;
// Confirmed that the base theme is available. // Confirm that all base themes are available.
$theme->incompatible_base = isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]); $theme->incompatible_base = (isset($theme->info['base theme']) && !($theme->base_themes === array_filter($theme->base_themes)));
// Confirm that the theme engine is available. // Confirm that the theme engine is available.
$theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner); $theme->incompatible_engine = isset($theme->info['engine']) && !isset($theme->owner);
} }
......
...@@ -319,6 +319,9 @@ function testSwitchDefaultTheme() { ...@@ -319,6 +319,9 @@ function testSwitchDefaultTheme() {
/** /**
* Test themes can't be installed when the base theme or engine is missing. * 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() { function testInvalidTheme() {
// theme_page_test_system_info_alter() un-hides all hidden themes. // theme_page_test_system_info_alter() un-hides all hidden themes.
...@@ -327,6 +330,7 @@ function testInvalidTheme() { ...@@ -327,6 +330,7 @@ function testInvalidTheme() {
$this->container->get('theme_handler')->reset(); $this->container->get('theme_handler')->reset();
$this->drupalGet('admin/appearance'); $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' => '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'))); $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. // 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."); $this->assertText("This theme is not compatible with Drupal 8.x. Check that the .info.yml file contains the correct 'core' value.");
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment