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 .= '
' . $screenshot . '

' . $theme->info['name'] . ' ' . (isset($theme->info['version']) ? $theme->info['version'] : '') . $notes . '

' . $description . '
'; - // Make sure to provide feedback on compatibility. - if (!empty($theme->incompatible_core)) { - $output .= '
' . t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => DRUPAL_CORE_COMPATIBILITY)) . '
'; - } - elseif (!empty($theme->incompatible_php)) { - if (substr_count($theme->info['php'], '.') < 2) { - $theme->info['php'] .= '.*'; - } - $output .= '
' . t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $theme->info['php'], '!php_version' => phpversion())) . '
'; + // Make sure to provide feedback on .info file errors. + if (!empty($theme->theme_info_error)) { + $output .= '
' . '

' . t('Theme .info file error messages.') . '

' . $theme->theme_info_error . '
'; } else { $output .= theme('links', array('links' => $theme->operations, 'attributes' => array('class' => array('operations', 'clearfix')))); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 334351e..184b908 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2472,7 +2472,8 @@ function _system_rebuild_theme_data() { // Set defaults for theme info. $defaults = array( 'engine' => 'phptemplate', - 'regions' => array( + 'name' => '???????', + 'regions' => array( 'sidebar_first' => 'Left sidebar', 'sidebar_second' => 'Right sidebar', 'content' => 'Content', @@ -2483,7 +2484,7 @@ function _system_rebuild_theme_data() { 'page_top' => 'Page top', 'page_bottom' => 'Page bottom', ), - 'description' => '', + 'description' => 'No Discription', 'features' => _system_default_theme_features(), 'screenshot' => 'screenshot.png', 'php' => DRUPAL_MINIMUM_PHP,