function _skinr_skinset in Skinr 6.2
Helper function to process a skin or theme .info file.
Return value
A skinset.
1 call to _skinr_skinset()
- skinr_skinsets in ./
skinr.module - Helper function to process an array of skins or themes .info files.
File
- ./
skinr.module, line 721
Code
function _skinr_skinset($info) {
$skinset = array(
'options' => array(
'groups' => array(),
),
'skins' => array(),
);
if (!empty($info->info['skinr'])) {
$path_root = dirname($info->filename);
$skinr_info = (array) $info->info['skinr'];
// Store skinr options.
if (!empty($skinr_info['options'])) {
$skinset['options'] = $skinr_info['options'];
unset($skinr_info['options']);
if (!isset($skinset['options']['groups'])) {
$skinset['options']['groups'] = array();
}
$defaults = skinr_group_default();
foreach ($skinset['options']['groups'] as $id => $group) {
$skinset['options']['groups'][$id] = array_merge($defaults, $skinset['options']['groups'][$id]);
$skinset['options']['groups'][$id]['collapsible'] = (bool) $skinset['options']['groups'][$id]['collapsible'];
$skinset['options']['groups'][$id]['collapsed'] = (bool) $skinset['options']['groups'][$id]['collapsed'];
$skinset['options']['groups'][$id]['weight'] = $skinset['options']['groups'][$id]['weight'];
}
}
// Add paths to $skinr_info.
_skinr_add_paths_to_files($skinr_info, $path_root);
// Inherit skins from parent theme, if inherit_skins is set to true.
if (!empty($skinset['options']['inherit_skins'])) {
// Paths get automatically added to base theme info.
$base_info = skinr_inherited_skins($info->name);
// Merge base theme and current.
$skinr_info = array_merge($base_info, $skinr_info);
}
$defaults = skinr_skin_default();
foreach ($skinr_info as $id => $skin) {
if (!is_array($skin)) {
continue;
}
$skinset['skins'][$id] = array(
'title' => isset($skin['title']) ? $skin['title'] : $defaults['title'],
'type' => isset($skin['type']) ? $skin['type'] : $defaults['type'],
'description' => isset($skin['description']) ? $skin['description'] : $defaults['description'],
'features' => isset($skin['features']) ? $skin['features'] : $defaults['features'],
'templates' => isset($skin['templates']) ? $skin['templates'] : $defaults['templates'],
'group' => !empty($skin['group']) && !empty($skinset['options']['groups'][$skin['group']]) ? $skin['group'] : $defaults['group'],
'options' => isset($skin['options']) ? $skin['options'] : $defaults['options'],
'stylesheets' => isset($skin['stylesheets']) ? $skin['stylesheets'] : $defaults['stylesheets'],
'scripts' => isset($skin['scripts']) ? $skin['scripts'] : $defaults['scripts'],
'weight' => isset($skin['weight']) ? $skin['weight'] : $defaults['weight'],
);
}
}
return $skinset;
}