开发者

What is the correct way to change the active Drupal theme programmatically?

开发者 https://www.devze.com 2023-01-20 16:07 出处:网络
What i开发者_JS百科s the correct way to change the active Drupal theme programmatically?Edit: here is a simpler example.

What i开发者_JS百科s the correct way to change the active Drupal theme programmatically?


Edit: here is a simpler example.

It uses Garland regardless of the theme setting. Note that this overrides the admin theme setting too.

function MODULENAME_init(){
    global $custom_theme;
    $custom_theme = 'garland';
}

Edit: changing globally.

And if you meant changing the theme setting in the database instead of just on the current page, here is how:

// Changes the theme to Garland
variable_set('theme_default', 'garland');

// Changes only the administration theme to Garland
variable_set('admin_theme', 'garland');
0

精彩评论

暂无评论...
验证码 换一张
取 消