function patterns_system_theme_default in Patterns 7
1 call to patterns_system_theme_default()
- set_active_theme_submit in patterns_components/
components/ system.inc
File
- patterns_components/
components/ system.inc, line 494
Code
function patterns_system_theme_default($theme, $default, $admin) {
// Get current list of themes.
$themes = list_themes();
// Check if the specified theme is one recognized by the system.
if (!empty($themes[$theme])) {
// Enable the theme if it is currently disabled.
if (empty($themes[$theme]->status)) {
// NOTE: this assumes sites/default/css exists.
theme_enable(array(
$theme,
));
}
if ($default) {
if ($admin) {
// Set the admin theme.
variable_set('admin_theme', $theme);
}
else {
// Set the default theme.
variable_set('theme_default', $theme);
}
}
// Rebuild the menu. This duplicates the menu_rebuild() in theme_enable().
// However, modules must know the current default theme in order to use
// this information in hook_menu() or hook_menu_alter() implementations,
// and doing the variable_set() before the theme_enable() could result
// in a race condition where the theme is default but not enabled.
menu_rebuild();
}
}