[development] $custom_theme when does it take effect... when doesit not

Jon Saints saintsjd at gmail.com
Thu Aug 14 22:55:14 UTC 2008

> If you're doing this in with custom code, you should give
> http://drupal.org/project/sections a try.  The module has been thoroughly
> tested and works AFAIK.  Similar, but different purpose is
> http://drupal.org/project/switchtheme.

Thanks. I will check out these modules

> You should not try to change the theme on block administration pages.  Above
> mentioned modules implement exactly this exception.

As for the bug in the block module, I think there is actually a good
reason that the author of the block module in core is trying (but not
succeeding) to change the theme on block administration pages.  As you
to edit blocks for different themes in the block admin it helps to
have the active theme change accordingly so that a user can see where
on the page the block regions will be appearing. Different themes can
have different arrangements of regions.

The bug occurs when the block_admin_display() function changes
$custom_theme variable and calls init_theme().  The global variable
$theme has already been set by a previous init_theme() call somehwere
in drupal so init_theme() is essentially ignored in
block_admin_display(). The theme does not change. That is why we are
seeing the wrong list of blocks appear for any theme that is not the
active theme.

So... how best to deal with this?

Do we:
1) always show the current default theme when editing blocks for other
themes (even though region arrangements might differ theme to theme)
2) do we write a block_init() hook to change the theme each time a
user chooses to edit blocks for a specific theme in the block admin. I
wonder how this would affect users that choose to use the admin theme

Thoughts on this one?


More information about the development mailing list