diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 23:27:32 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 23:27:32 +0000 |
commit | 5e5a07f513ee793a8bbe5094895b4ebd5a1de8a2 (patch) | |
tree | daf309c4579f62bf80b3c7461d39a5835f20706a /includes/theme.inc | |
parent | 3409019929da282bca397ccfa64985c5d74394f9 (diff) | |
download | brdo-5e5a07f513ee793a8bbe5094895b4ebd5a1de8a2.tar.gz brdo-5e5a07f513ee793a8bbe5094895b4ebd5a1de8a2.tar.bz2 |
#141725 by Crell and dvessel: allow themes to define multiple CSS and JS files in their .info files, which can be clearly overriden
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 569c5d256..7bc2d309d 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -100,33 +100,18 @@ function _init_theme($theme, $base_theme = array()) { $theme_path = dirname($theme->filename); - // Add the default stylesheet - if (!empty($theme->stylesheet)) { - drupal_add_css($theme->stylesheet, 'theme'); - } - else { - // If we don't have a stylesheet of our own, look for the first - // base to have one and use its. - foreach ($base_theme as $base) { - if (!empty($base->stylesheet)) { - drupal_add_css($base->stylesheet, 'theme'); - break; + // Add stylesheets used by this theme. + if (!empty($theme->stylesheets)) { + foreach ($theme->stylesheets as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet) { + drupal_add_css($stylesheet, 'theme', $media); } } } - - // Add the default script - if (!empty($theme->script)) { - drupal_add_js($theme->script, 'theme'); - } - else { - // If we don't have a script of our own, look for the first - // base to have one and use its. - foreach ($base_theme as $base) { - if (!empty($base->script)) { - drupal_add_js($base->script, 'theme'); - break; - } + // Add scripts used by this theme. + if (!empty($theme->scripts)) { + foreach ($theme->scripts as $script) { + drupal_add_js($script, 'theme'); } } @@ -356,11 +341,17 @@ function list_themes($refresh = FALSE) { while ($theme = db_fetch_object($result)) { if (file_exists($theme->filename)) { $theme->info = unserialize($theme->info); - if (!empty($theme->info['stylesheet']) && file_exists($theme->info['stylesheet'])) { - $theme->stylesheet = $theme->info['stylesheet']; + foreach ($theme->info['stylesheets'] as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet => $path) { + if (file_exists($path)) { + $theme->stylesheets[$media][$stylesheet] = $path; + } + } } - if (!empty($theme->info['script']) && file_exists($theme->info['script'])) { - $theme->script = $theme->info['script']; + foreach ($theme->info['scripts'] as $script => $path) { + if (file_exists($path)) { + $theme->scripts[$script] = $path; + } } if (isset($theme->info['engine'])) { $theme->engine = $theme->info['engine']; |