question on $custom_theme
inforeto - July 29, 2009 - 21:20
| Project: | Sections |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I have setup a 6.x site with sections but the section for admin pages isn't being applied.
On system_init $custom_theme has the right value of 'garland' until it is overriden to 0.
Changing the code to keep the value of $custom_theme makes sections work again.
<?php
function system_init() {
// Use the administrative theme if the user is looking at a page in the admin$
if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == $
global $custom_theme;
if (!$custom_theme) {
$custom_theme = variable_get('admin_theme', '0');
}
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
}
?>I notice older closed posts like http://drupal.org/node/242299#comment-1146885
Apparently hook_init has weights so sections_init should go after system_init.
It may be that module weights are wrong only on the test site, should sections work out of the box?
The site is using sections-6.x-1.x-dev of 2009-Mar-28.

#1
Disable admin theme. And never use DEV versions - they could be unstable.
#2
Present in 6.x-1.2, how do you disable admin_theme?
It was set to "system default" and then disabled by sections,
after this the variable 'admin_theme' still exists and has a value of 0.
On the test site there's supposedly no other modules installed that explicitly deal with setting an admin theme.
Would you need to manually deleting the variable? if so would it break anything?
Apart of that it seems that in system_init if 'admin_theme' does not exist it still passes a default value of 0 thus overwriting $custom_theme.
$custom_theme = variable_get('admin_theme', '0');
I assume from reading the older posts that $custom_theme may be expected to come after this call of system_init based on module weights.
However, in my test site the theme chosen in sections is already in $custom_theme by the time system_init overwrites it with a value of 0.
Should this work out of the box?
(duplicate issues like http://drupal.org/node/569742 are also marked fixed)