如何使用 .tpl
文件覆盖主题函数?我知道如何使用主题函数覆盖 .tpl
文件,但反之则不然。我似乎找不到任何地方告诉我这一点,所以也许这是不可能的或不是好的做法。
例如,如果在名为 super_results
的模块中定义了一个主题函数,并在主题注册表中注册,如下例所示,我将如何使用 super_results.tpl 覆盖它.php
。
'super_results' => array(
'arguments' => array('title' => NULL, 'results' => NULL, 'votes' => NULL),
),
function modulename_super_results($title, $results,$votes){ output HTML }
最佳答案
最简单的解决方案可能是创建一个使用模板的新主题功能。类似的东西应该可以工作,免责声明代码未经测试。
function my_theme_theme() {
return array(
'overide' => array(
'template' => 'elm-super_results',
'arguments' => array('title' => NULL, 'results' => NULL, 'votes' => NULL),
),
);
}
function my_theme_super_results($title, $results, $votes) {
return theme('overide', $title, $results, $votes);
}
关于drupal - 我可以使用 .tpl 文件覆盖主题函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2630954/