Issue #2489830 by cilefen, davidhernandez, dcmul, Adam Clarey, joshi.rohit100, rpayanm, sqndr, Cottser, lauriii: Improve theme compatibility error message
parent
ba1b14e41f
commit
f1e618ec25
|
@ -241,9 +241,10 @@ class SystemController extends ControllerBase {
|
|||
|
||||
if (empty($theme->status)) {
|
||||
// Ensure this theme is compatible with this version of core.
|
||||
$theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != \DRUPAL::CORE_COMPATIBILITY);
|
||||
// Require the 'content' region to make sure the main page
|
||||
// content has a common place in all themes.
|
||||
$theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != \DRUPAL::CORE_COMPATIBILITY) || !isset($theme->info['regions']['content']);
|
||||
$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']]);
|
||||
|
|
|
@ -273,6 +273,10 @@ class ThemeTest extends WebTestBase {
|
|||
$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 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.");
|
||||
// Check for the error text of a theme without a content region.
|
||||
$this->assertText("This theme is missing a 'content' region.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -420,7 +420,10 @@ function template_preprocess_system_themes_page(&$variables) {
|
|||
// Make sure to provide feedback on compatibility.
|
||||
$current_theme['incompatible'] = '';
|
||||
if (!empty($theme->incompatible_core)) {
|
||||
$current_theme['incompatible'] = t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => \Drupal::CORE_COMPATIBILITY));
|
||||
$current_theme['incompatible'] = t("This theme is not compatible with Drupal @core_version. Check that the .info.yml file contains the correct 'core' value.", ['@core_version' => \Drupal::CORE_COMPATIBILITY]);
|
||||
}
|
||||
elseif (!empty($theme->incompatible_region)) {
|
||||
$current_theme['incompatible'] = t("This theme is missing a 'content' region.");
|
||||
}
|
||||
elseif (!empty($theme->incompatible_php)) {
|
||||
if (substr_count($theme->info['php'], '.') < 2) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
name: 'Theme test with invalid core version'
|
||||
type: theme
|
||||
description: 'Test theme which has an invalid core version.'
|
||||
version: VERSION
|
||||
core: 7.x
|
|
@ -0,0 +1,8 @@
|
|||
name: 'Theme test with missing content region'
|
||||
type: theme
|
||||
description: 'Test theme which has a non-existent content region.'
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
|
||||
regions:
|
||||
- foo: Foo
|
Loading…
Reference in New Issue