Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.609 diff -u -p -r1.609 theme.inc --- includes/theme.inc 5 Sep 2010 02:21:37 -0000 1.609 +++ includes/theme.inc 7 Sep 2010 06:50:50 -0000 @@ -143,6 +143,7 @@ function _drupal_theme_initialize($theme // Grab stylesheets from base theme foreach ($base_theme as $base) { + // Add stylesheets. if (!empty($base->stylesheets)) { foreach ($base->stylesheets as $media => $stylesheets) { foreach ($stylesheets as $name => $stylesheet) { @@ -150,8 +151,17 @@ function _drupal_theme_initialize($theme } } } + // Remove base stylesheets. + if (!empty($base->stylesheets_remove)) { + foreach ($final_stylesheets as $media => $stylesheets) { + foreach ($stylesheets as $name => $stylesheet) { + if (isset($base->stylesheets_remove[$name])) { + unset($final_stylesheets[$media][$name]); + } + } + } + } } - // Add stylesheets used by this theme. if (!empty($theme->stylesheets)) { foreach ($theme->stylesheets as $media => $stylesheets) { @@ -160,11 +170,23 @@ function _drupal_theme_initialize($theme } } } + // Remove stylesheets specified by this theme. + if (!empty($theme->stylesheets_remove)) { + foreach ($final_stylesheets as $media => $stylesheets) { + foreach ($stylesheets as $name => $stylesheet) { + if (isset($theme->stylesheets_remove[$name])) { + unset($final_stylesheets[$media][$name]); + } + } + } + } // And now add the stylesheets properly foreach ($final_stylesheets as $media => $stylesheets) { foreach ($stylesheets as $stylesheet) { - drupal_add_css($stylesheet, array('weight' => CSS_THEME, 'media' => $media, 'preprocess' => TRUE)); + if (file_exists($stylesheet)) { + drupal_add_css($stylesheet, array('weight' => CSS_THEME, 'media' => $media, 'preprocess' => TRUE)); + } } } @@ -600,7 +622,14 @@ function list_themes($refresh = FALSE) { foreach ($themes as $theme) { foreach ($theme->info['stylesheets'] as $media => $stylesheets) { foreach ($stylesheets as $stylesheet => $path) { - $theme->stylesheets[$media][$stylesheet] = $path; + if (file_exists($path)) { + $theme->stylesheets[$media][$stylesheet] = $path; + } + } + } + if (isset($theme->info['stylesheets-remove'])) { + foreach ($theme->info['stylesheets-remove'] as $stylesheet) { + $theme->stylesheets_remove[$stylesheet] = $stylesheet; } } foreach ($theme->info['scripts'] as $script => $path) {