views:

80

answers:

0

I'm trying to change the CSS file used by modifying the $variables array in a module. For certain times of day I need to change the css file from style.css to style-green.css. Here is my function in my custom module:

function cssswitch_preprocess_page(&$variables) {


    //print '<pre>';
    //print_r($variables);
    //print_r($variables['css']['all']['module']);
    //print_r($variables['css']['all']);
    //print_r($variables['css']['all']['theme']);
    //print '</pre>'; //exit();

     $styleArr=$variables['css']['all']['theme'];
     foreach($styleArr AS $path => $value){
        $stylePath=$path;
     }

     //echo $stylePath;

     // unset the old style
     unset($variables['css']['all']['theme'][$stylePath]);

     // set different style
     $variables['css']['all']['theme']['themes/garland/style-green.css']=1;


}