Posted by ManyNancy on April 9, 2010 at 12:04am
I wish to hardcode theme switching on certain paths in a module. Where can I find examples and such?
Thanks.
I wish to hardcode theme switching on certain paths in a module. Where can I find examples and such?
Thanks.
Comments
Theme switching
How about using ThemeKey: http://drupal.org/project/themekey
Ferlito/van der Wyk | Drupal web design & development
No, I need to do this in my
No, I need to do this in my own module and I don't like the overhead.
In that case you can
In that case you can implement it in a hook like this:
<?phpfunction mymodule_init() {
global $custom_theme;
if (arg(0) == 'node' && arg(2) == 'edit') {
$custom_theme = variable_get('theme_default', '0');
init_theme();
}
}
?>
In this example we switch the theme to the default theme on a node edit page.
Ferlito/van der Wyk | Drupal web design & development
Oh thank you so much.
Oh thank you so much.
So let's say I want to use
So let's say I want to use Chameleon on the node edit page. (It's not my default theme)
Is it like this? Not working for me.
<?phpfunction mymodule_init() {
global $custom_theme;
if (arg(0) == 'node' && arg(2) == 'edit') {
$custom_theme = variable_get('chameleon', '0');
init_theme();
}
}
?>
Thanks.
No actually it would be
No actually it would be this:
<?phpfunction mymodule_init() {
global $custom_theme;
if (arg(0) == 'node' && arg(2) == 'edit') {
$custom_theme = 'chameleon';
init_theme();
}
}
?>
Ferlito/van der Wyk | Drupal web design & development