php - 以编程方式更改事件的 Drupal 7 主题

标签 php drupal drupal-7 drupal-modules drupal-theming

以编程方式更改事件 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/

相关文章:

javascript - Drupal 8 View 幻灯片图像在 IE 11 中大小不正确

Drupal - 禁用分类术语页面上的节点列表?

java - Alfresco 错误 Web 脚本状态 500 - 内部错误 Web

facebook - Drupal7 Feeds 模块 Facebook feed 被截断为 80 个字符

php - 是否有用于处理单位和数量的 PHP 库/类?

php - mysql复制phpmyadmin windows版

mysqld --defaults-file 和 tmpdir 问题

drupal - 我可以修改特定菜单的 theme_menu_link 吗?

php - 数据表 |如何做自己的选择?

php - 带有 FormData 的 XHR 请求正在发布一个空数组,