function skinr_flatten_skins_array in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr.module \skinr_flatten_skins_array()
- 6.2 skinr.module \skinr_flatten_skins_array()
Returns an array of classes.
@todo Optimize this function by removing dependencies on the resource heavy skinr_get_skin_info() function. @todo Rename function to reflect new functionality.
Parameters
$skin_options: An array of skin options keyed by their skin name. The key '_additional' is reserved for additional classes entered by the user.
2 calls to skinr_flatten_skins_array()
- skinr_panels_preprocess_page in skinr_panels/
skinr_panels.module - Implements hook_preprocess_page().
- skinr_preprocess in ./
skinr.module - Implements hook_preprocess().
File
- ./
skinr.module, line 201 - Handles core Skinr functionality.
Code
function skinr_flatten_skins_array($skin_options) {
$skin_info = skinr_get_skin_info();
$classes = array();
foreach ($skin_options as $skin_name => $options) {
if ($skin_name == '_additional') {
$classes = array_merge($classes, $options);
}
else {
foreach ($options as $option) {
if (!empty($skin_info[$skin_name]['options'][$option]['class'])) {
$classes = array_merge($classes, $skin_info[$skin_name]['options'][$option]['class']);
}
}
}
}
return array_unique($classes);
}