Im writing a custom module that need to insert some javascript and css files only in a Views page.
Im using hook_preprocess_page, but I can not tell if the current page is from a view:
function mymodule_preprocess_page(&vars)
{
var_dump($vars); //output: nothings that reference the views!
if([view page])
{
drupal_add_js([...]);
drupal_add_css([...]);
// Rebuild scripts
$scripts = drupal_get_js();
$vars['scripts'] = $scripts;
// Same for css
}
}
I know i could use a template file (page-my_view_page_path.tpl.php), but the js and extra css must be included only if my module is enabled; so I like to keep this things directly inside my module code.
Ideas?