Skip to content

Commit

Permalink
BUGFIX: Make themedCSS use {theme}_{module}/css/{name}.css files if t…
Browse files Browse the repository at this point in the history
…hey exist

2.4 used to use a manifest to find css. One side-effect of that is that even without explicit support,
css files in module-specific themes (/themes/{theme}_{module}/) would get picked up. This broke in 3.

This fix does still require the module name to be explicitly passed as a parameter to themedCSS, but if
you do, and a css file of that name exists in the module-specific themes css directory, that will
be included in preference to the theme or module provided css
  • Loading branch information
Hamish Friedlander committed Jun 22, 2012
1 parent bba7a7a commit 0bea697
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions view/Requirements.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1074,16 +1074,18 @@ function get_custom_scripts() {
* @see Requirements::themedCSS() * @see Requirements::themedCSS()
*/ */
public function themedCSS($name, $module = null, $media = null) { public function themedCSS($name, $module = null, $media = null) {
$theme = SSViewer::current_theme(); $path = SSViewer::get_theme_folder();
$path = SSViewer::get_theme_folder() . "/css/$name.css"; $abspath = BASE_PATH . DIRECTORY_SEPARATOR . $path;
$css = "/css/$name.css";


if (file_exists(BASE_PATH . '/' . $path)) { if ($module && file_exists($abspath.'_'.$module.$css)) {
$this->css($path, $media); $this->css($path.'_'.$module.$css, $media);
return;
} }

else if (file_exists($abspath.$css)) {
if ($module) { $this->css($path.$css, $media);
$this->css("$module/css/$name.css"); }
else if ($module) {
$this->css($module.$css);
} }
} }


Expand Down

0 comments on commit 0bea697

Please sign in to comment.