I wish to hardcode theme switching on certain paths in a module. Where can I find examples and such?
Thanks.
How about using ThemeKey: http://drupal.org/project/themekey
No, I need to do this in my own module and I don't like the overhead.
In that case you can implement it in a hook like this:
function 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.
Oh thank you so much.
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.
function mymodule_init() { global $custom_theme; if (arg(0) == 'node' && arg(2) == 'edit') { $custom_theme = variable_get('chameleon', '0'); init_theme(); } }
No actually it would be this:
function mymodule_init() { global $custom_theme; if (arg(0) == 'node' && arg(2) == 'edit') { $custom_theme = 'chameleon'; init_theme(); } }
Comments
Theme switching
How about using ThemeKey: http://drupal.org/project/themekey
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:
In this example we switch the theme to the default theme on a node edit page.
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.
Thanks.
No actually it would be
No actually it would be this: