【发布时间】:2012-11-04 21:41:59
【问题描述】:
我正在为 drupal 7 编写模块。模块在该块 ['content'] 内生成块和项目列表。当我使用标准主题('item_list', array('items' => $items)) 一切正常,但是当我想定义我自己的主题来代替 item_list 时,阻止消失。我一直在阅读文档和各种示例,但没有任何帮助。在我的模块文件中,我写道:
function lastposts_thm_theme() {
return array(
'lastposts_thm' => array(
'variables' => array('items' => NULL),
//template file, path, ....
),
);
}
function theme_lastposts_thm($variables) {
$node = $variables['items'];
$build = node_view($node);
$output = drupal_render($build);
return $output;
}
当我从 block_view 函数调用它时,它不起作用主题('lastposts_thm',$...)。 我在哪里弄错了?
【问题讨论】:
-
调用主题('lastposts_thm', array('items' => $items))
-
我知道,我这样称呼它,不起作用。
标签: drupal drupal-7 drupal-modules drupal-theming