diff --git a/core/modules/system/system.admin.css b/core/modules/system/system.admin.css index 7299484..6bd8e69 100644 --- a/core/modules/system/system.admin.css +++ b/core/modules/system/system.admin.css @@ -211,9 +211,13 @@ table.screenshot { .system-themes-list-disabled .theme-info { min-height: 170px; } -.theme-selector .incompatible { - margin-top: 10px; - font-weight: bold; +.theme-selector .theme_info_error { + margin-top: 10px; + padding: 0.5em; + font-weight: bold; + color: #8c2e0b; + border: 1px solid #ed541d; + background-color: #fef5f1; } .theme-selector .operations { margin: 10px 0 0 0; diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index aa2f98f..0b28828 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -164,15 +164,42 @@ function system_themes_page() { } if (empty($theme->status)) { + // Test disabled and new themes for errors in their .info file. // Ensure this theme is compatible with this version of core. // 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_php = version_compare(phpversion(), $theme->info['php']) < 0; + // Require a value be provided for Name. + // Require that the base theme specified in a subtheme + // actually exist. + $theme->theme_info_error = ''; + if (!isset($theme->info['core']) || ($theme->info['core'] != DRUPAL_CORE_COMPATIBILITY)) { + $theme->theme_info_error .= '
' . t('The specified value of CORE = !core_value is not compatible with this version of Drupal = !core_version.', array('!core_value' => $theme->info['core'], '!core_version' => VERSION)) . '
'; + } + if (version_compare(phpversion(), $theme->info['php']) < 0) { + if (substr_count($theme->info['php'], '.') < 2) { + $theme->info['php'] .= '.*'; + } + $theme->theme_info_error .= '' . t("The specified version of PHP = @php_specified is incompatible with this server's PHP version = !php_version .", array('@php_specified' => $theme->info['php'], '!php_version' => phpversion())) . '
'; + } + if (!isset($theme->info['regions']['content'])) { + $theme->theme_info_error .= '' . t("'regions[content]' must be specified in the .info file if defaults are not used.") . '
'; + } + if ($theme->info['name'] == '???????') { + $theme->theme_info_error .= '' . t('A value for NAME is required in the .info file.') . '
'; + } + if (isset($theme->info['base theme'])) { + $base_key = $theme->info['base theme']; + if (!isset($themes[$base_key])) { + $theme->theme_info_error .= '' . t("This theme is a subtheme but the base theme = @basetheme doesn't exist.", array('@basetheme' => $theme->info['base theme'])) . '
'; + } + } + if (!empty($theme->theme_info_error)) { + drupal_set_message(t('One or more errors were detected in one or more theme .info files. Please check below for error messages.'), 'error', FALSE); } + } $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) || !empty($theme->theme_info_error)) { // Create the operations links. $query['theme'] = $theme->name; if (drupal_theme_access($theme)) { @@ -2707,15 +2734,9 @@ function theme_system_themes_page($variables) { $theme->classes[] = 'clearfix'; $output .= '