the*_*uke 8 drupal drupal-6 drupal-theming drupal-modules
我有一个添加新内容类型的模块.
对于此内容类型,我想提供node_contenttype.tpl.php节点类型模板,但Drupal不会在模块目录中识别此模板,仅在主题中.
如何让Drupal(6)使用我的模板?
Lax*_*n13 10
你可以使用hook_theme_registry_alter()
以下是在我自定义模块中使用它的示例(只需将'mymodule'替换为模块名称):
/**
* Implementation of hook_theme_registry_alter()
*/
function mymodule_theme_registry_alter(&$theme_registry) {
$template = 'node';
$originalpath = array_shift($theme_registry[$template]['theme paths']);
$modulepath = drupal_get_path('module', 'mymodule');
// Stick the original path with the module path back on top
array_unshift($theme_registry[$template]['theme paths'], $originalpath, $modulepath);
}
Run Code Online (Sandbox Code Playgroud)
现在,Drupal将检查您的模块文件夹以查找节点模板覆盖.
| 归档时间: |
|
| 查看次数: |
2190 次 |
| 最近记录: |