function skinr_current_theme in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr.module \skinr_current_theme()
- 6.2 skinr.module \skinr_current_theme()
- 6 skinr.module \skinr_current_theme()
Helper function to retrieve the current theme.
Parameters
$exclude_admin_theme: Optional. Set to TRUE to exclude the admin theme from possible themes to return.
Return value
The current theme name.
See also
11 calls to skinr_current_theme()
- skinr_context_ui_admin_list_subform in skinr_context/
skinr_context_ui.admin.inc - Overrides skinr_ui_admin_skins().
- skinr_context_ui_form_submit in skinr_context/
skinr_context_ui.module - Form submission handler for skinr_context_form_alter().
- skinr_group_features_export_options in skinr_context/
skinr_context.features.inc - Implements hook_features_export_options().
- skinr_preprocess in ./
skinr.module - Implements hook_preprocess().
- skinr_test_skinr_current_theme in tests/
skinr_test/ skinr_test.module - Page callback for default 'skinr_current_theme' test.
File
- ./
skinr.module, line 1249 - Handles core Skinr functionality.
Code
function skinr_current_theme($exclude_admin_theme = FALSE) {
global $user, $theme;
// Drupal core, and modules such as themkey and og_theme, set the theme
// through hook_custom_theme() or hook_menu() using 'theme callback', which
// are all picked up by menu_get_custom_theme().
$current_theme = $theme;
if ($exclude_admin_theme) {
// Only select the user selected theme if it is available in the
// list of themes that can be accessed.
$current_theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'bartik');
// Allow modules to override the theme. Validation has already been performed
// inside menu_get_custom_theme(), so we do not need to check it again here.
$custom_theme = menu_get_custom_theme();
if ($custom_theme != variable_get('admin_theme', '0')) {
$current_theme = !empty($custom_theme) ? $custom_theme : $current_theme;
}
}
return $current_theme;
}