以编程方式更改事件 Drupal 7 主题的正确方法是什么?我在 Drupal 6 中使用了 $custom_theme
,但它在 Drupal 7 中不起作用。
最佳答案
您可以使用 hook_custom_theme()
:
function mymodule_custom_theme() {
if ($some_condition_is_true) {
return 'my_theme';
}
}
如果您需要根据路径进行选择,那么最好的方法是覆盖特定菜单路由器项的主题回调
。 See here for an example .
关于php - 以编程方式更改事件的 Drupal 7 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8151062/