Drupal 模块中的自有主题
我正在为Drupal7编写模块。模块在块['content']内生成块和项列表。当我使用标准主题('item_list',array('items'=>$items')时,一切都正常,但当我想定义自己的主题,用它代替item_list时,阻止dissapears。我一直在阅读文档和各种示例,但没有任何帮助。在我的模块文件中,我写道:Drupal 模块中的自有主题,drupal,drupal-7,drupal-modules,drupal-theming,Drupal,Drupal 7,Drupal Modules,Drupal Theming,我正在为Drupal7编写模块。模块在块['content']内生成块和项列表。当我使用标准主题('item_list',array('items'=>$items')时,一切都正常,但当我想定义自己的主题,用它代替item_list时,阻止dissapears。我一直在阅读文档和各种示例,但没有任何帮助。在我的模块文件中,我写道: function lastposts_thm_theme() { return array( 'lastposts_thm' => array(
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',array('items'=>$items)),我知道,我这样称呼它,不起作用。