How Drupal 5's Administration Theme functionality works
Drupal's administration theme functionality works very simply: if the first argument of the internal path is admin, the custom theme is set to the admin theme.
This suggests that the $custom_theme variable can be set by modules to change to any arbitrary theme, and it will override the default theme.
The setting of custom_theme to admin_theme is done in system module's implementation of hook_menu:
<?php
/**
* Implementation of hook_menu().
*/
function system_menu($may_cache) {
$items = array();
if ($may_cache) {
/* cut */
}
else {
/**
* Use the administrative theme if the user is looking at a page in the admin/* path.
*/
if (arg(0) == 'admin') {
global $custom_theme;
$custom_theme = variable_get('admin_theme', '0');
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
}
// Add the CSS for this module. We put this in !$may_cache so it is only
// added once per request.
drupal_add_css(drupal_get_path('module', 'system') .'/defaults.css', 'module');
drupal_add_css(drupal_get_path('module', 'system') .'/system.css', 'module');
}
return $items;
}
?>
Some other places custom_theme pops up, which ears more investigation:
Ebony-II:drupal-5.7 ben$ grep -nHR custom_theme .
./includes/theme.inc:33: global $theme, $user, $custom_theme, $theme_engine, $theme_key;
./includes/theme.inc:49: $theme = $custom_theme && $themes[$custom_theme] ? $custom_theme : $theme;
./modules/block/block.module:207: global $theme_key, $custom_theme;
./modules/block/block.module:214: $custom_theme = $theme;
./modules/block/block.module:217: $custom_theme = variable_get('theme_default', 'garland');
./modules/system/system.module:309: global $custom_theme;
Comments
Post new comment