function _skinr_add_file in Skinr 6
Same name and namespace in other branches
- 6.2 skinr.module \_skinr_add_file()
Helper function to add CSS and JS files.
The function checks an array of paths for the existence of the file to account for base themes.
1 call to _skinr_add_file()
- skinr_preprocess in ./
skinr.module - Implementation of hook_preprocess().
File
- ./
skinr.module, line 398
Code
function _skinr_add_file($filename, $themes, $type, $media = NULL) {
if (!is_array($themes)) {
$themes = array(
$themes,
);
}
foreach ($themes as $theme) {
$file = drupal_get_path('theme', $theme) . '/' . $filename;
if (file_exists($file)) {
if ($type == 'css') {
drupal_add_css($file, 'theme', $media);
}
else {
drupal_add_js($file, 'theme');
}
break;
}
}
}