diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 20ea39e409df470c8b5f4fc5830a8fbc580172d2..6bae39764d7f387562b07b41286f8bd53f840cbc 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -241,9 +241,10 @@ public function themesPage() { 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']]); diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php index 84745b7c29772571e90c4edc618f45d89d063651..7c852758839f17b5b67441e5c8712ecd3dcc59c0 100644 --- a/core/modules/system/src/Tests/System/ThemeTest.php +++ b/core/modules/system/src/Tests/System/ThemeTest.php @@ -273,6 +273,10 @@ function testInvalidTheme() { $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."); } /** diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 1141a353d71f53d3cb991d3adbc7a23c3430bc3f..cc9184981bee8ce73dff1bb37021dabeec909c62 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -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) { diff --git a/core/modules/system/tests/themes/test_invalid_core/test_invalid_core.info.yml b/core/modules/system/tests/themes/test_invalid_core/test_invalid_core.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..5c369a64e6902816e19311ce5f9401c478ee5522 --- /dev/null +++ b/core/modules/system/tests/themes/test_invalid_core/test_invalid_core.info.yml @@ -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 diff --git a/core/modules/system/tests/themes/test_invalid_region/test_invalid_region.info.yml b/core/modules/system/tests/themes/test_invalid_region/test_invalid_region.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..6fef32a21dc3bb56f4eb49b269063994074a5115 --- /dev/null +++ b/core/modules/system/tests/themes/test_invalid_region/test_invalid_region.info.yml @@ -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