function _skinr_preprocess_attached in Skinr 7.2
1 call to _skinr_preprocess_attached()
- skinr_skin_info_process in ./
skinr.module - Parse a skin_infos array as returned from a skins plugin.
File
- ./
skinr.module, line 1353 - Handles core Skinr functionality.
Code
function _skinr_preprocess_attached(&$attached, $source) {
foreach (array(
'css',
'js',
) as $type) {
if (isset($attached[$type])) {
$keys = array_keys($attached[$type]);
foreach ($keys as $pos => $key) {
$options = $attached[$type][$key];
// If the value is not an array, it's a filename and passed as first
// (and only) argument. Turn it into an array so we can insert our defaults.
if (!is_array($options)) {
$key = $options;
$options = array();
$attached[$type][$key] = $options;
_skinr_array_splice($attached[$type], $pos, 1, array(
$key => $options,
));
}
// Add path to relative stylesheet and script paths. If the url is
// absolute (e.g. the url start with 'http://' or 'https://') or
// relative to the site's root (e.g. the url starts with '/') the path
// does not get prepended.
if (is_numeric($key)) {
// If $options is an array, but $key is not a filename, find $key in
// the $options array.
if (_skinr_is_local_file($source['path'] . '/' . $options['data'])) {
$attached[$type][$key]['data'] = $source['path'] . '/' . $options['data'];
}
}
elseif (_skinr_is_local_file($source['path'] . '/' . $key)) {
$key = $source['path'] . '/' . $key;
_skinr_array_splice($attached[$type], $pos, 1, array(
$key => $options,
));
}
// Add in defaults.
$attached[$type][$key] += array(
'preprocess' => FALSE,
);
}
}
}
}