Merge pull request #562 from silverstripe-rebelalliance/bugfix/themedcss

Make themedCSS use {theme}_{module}/css/{name}.css files if they exist
This commit is contained in:
Sam Minnée 2012-06-21 18:41:07 -07:00
commit 5e47159a52

View File

@ -1074,16 +1074,18 @@ class Requirements_Backend {
* @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);
} }
} }