Assign a specific theme to a module page or menu item
In Drupal 7 there is a new menu item parameter called "theme callback". This parameter acts similar to the "page callback" but it basically refers to a function to get apply a theme to the page.
So if for example there are 2 enabled themes ( Important that the theme is enabled otherwise it could not work ) and you would like to change the default theme for a specific page, you can set the theme callback and return the theme name string in the function you specify.
function mymodule_menu()
{
$items = array();
$items['user/account'] = array(
'title' => t('Personal Account'),
'page callback' => 'account_page',
'access arguments' => array('access content'),
'file' => 'user.account.inc',
'theme callback' => 'mymodule_default_node_theme',
);
return $items;
}
function mymodule_default_node_theme() {
return 'mythemename'; //return the name of the theme
}
Written by Simon Facciol
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Drupal
Authors
Related Tags
#drupal
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#