function skinr_ui_get_skinable_hooks in Skinr 8.2
Same name and namespace in other branches
- 7.2 skinr_ui.module \skinr_ui_get_skinable_hooks()
Fetch all theme_hooks that are compatible with active skins.
Return value
An array of all theme hooks listed in active skins for current theme.
1 call to skinr_ui_get_skinable_hooks()
- skinr_ui_element_is_skinable in skinr_ui/
skinr_ui.module - Fetch all theme_hooks that are compatible with active skins.
File
- skinr_ui/
skinr_ui.module, line 105 - Handles Skinr UI functionality allowing users to apply skins to their site.
Code
function skinr_ui_get_skinable_hooks($theme = NULL) {
$skinable_hooks =& drupal_static(__FUNCTION__);
if (!isset($skinable_hooks)) {
if ($cached = \Drupal::cache()
->get('skinr_skinable_hooks')) {
$skinable_hooks = $cached->data;
}
}
if (!isset($theme)) {
$theme = skinr_current_theme();
}
if (!isset($skinable_hooks[$theme])) {
$skinable_hooks[$theme] = array();
$skin_infos = skinr_get_skin_info();
foreach ($skin_infos as $skin_name => $skin_info) {
$skin_infos[$skin_name]['status'] = skinr_skin_info_status_get($skin_infos[$skin_name]);
if (!empty($skin_infos[$skin_name]['status'][$theme])) {
foreach ($skin_infos[$skin_name]['theme hooks'] as $active_hook) {
if (!isset($skinable_hooks[$active_hook])) {
$skinable_hooks[$theme][$active_hook] = $active_hook;
}
}
}
}
// Allow modules to alter config info via hook_skinr_skinnable_hooks_alter().
\Drupal::moduleHandler()
->alter('skinr_skinable_hooks', $skinable_hooks);
\Drupal::cache()
->set('skinr_skinable_hooks', $skinable_hooks);
}
return $skinable_hooks[$theme];
}