diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php index 30d84223d0b..ed43e49aa84 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -231,4 +231,14 @@ class ThemeTest extends WebTestBase { $this->drupalGet('admin/structure/block'); $this->assertText('Stark(' . t('active tab') . ')', t('Default local task on blocks admin page has changed.')); } + + /** + * Test that themes can't be enabled when the base theme or engine is missing. + */ + function testInvalidTheme() { + module_enable(array('theme_page_test')); + $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')), 'Invalid base theme check succeeded.'); + $this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => 'not_real_engine')), 'Invalid theme engine check succeeded.'); + } } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 2947245d4ea..2e424adbee4 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -156,10 +156,14 @@ function system_themes_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_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 the theme engine is available. + $theme->incompatible_engine = (isset($theme->info['engine']) && !isset($theme->owner)); } $query['token'] = drupal_get_token('system-theme-operation-link'); $theme->operations = array(); - if (!empty($theme->status) || !$theme->incompatible_core && !$theme->incompatible_php) { + if (!empty($theme->status) || !$theme->incompatible_core && !$theme->incompatible_php && !$theme->incompatible_base && !$theme->incompatible_engine) { // Create the operations links. $query['theme'] = $theme->name; if (drupal_theme_access($theme)) { @@ -2725,6 +2729,12 @@ function theme_system_themes_page($variables) { } $output .= '