Quantcast
Viewing all articles
Browse latest Browse all 294937

Drupal 7 custom module load css for specific theme template

I have a custom module that i've created and I have set the theme template like this:

<?php
/**
* Implemtnation of hook_theme()
*/
function custom_slider_theme($existing, $type, $theme, $path) {
    return array(
       
'custom_slider'=> array(
           
'variables'=> array('nodes'=> NULL),
           
'template'=> 'custom_slider',
        ),
    );
}
?>

This is all working fine.

What I can't find is how to load a css file for that template so when custom_slider.tpl.php is loaded the relevent css file is loaded. I don't need that css loaded on every page. I would rather call drupal_add_css() only when it's needed.

Any help with this is very much appreciated.

C


Viewing all articles
Browse latest Browse all 294937

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>