我正在为 Drupal 7 开发一个模块。我为我的内容类型定义了一个模板作为 node--[content type].tpl.php 并将它放在“themes/[selected theme]/template”目录中。我想将此模板保留在我的“模块”目录中。因此,当安装模块时,我不必每次都将文件放入选定的主题文件夹中。有没有办法做到这一点?
谢谢大家。
我的代表少于 10,所以我无法回答自己的问题,所以我将修改问题
以下内容对我有用。对于案例节点编辑表单视图和节点视图
function [content type]_theme() {
return array(
'[content type]_node_form' => array(
'arguments' => array(
'form' => NULL,
),
'template' => 'node--[content type]--edit',
'render element' => 'form',
),
'node__[content type]' => array (
'variables' => array(),
'template' => 'node--[content type]' ,
'base hook' => 'node',
'path' => "sites/all/modules/[content type]_update/[content type]_update/[content type]/",
),
);
}
我不完全理解这一点,但它正在工作。