[英]theme form on drupal 6
I have a form 'pub_form' which has function $form['#theme'] = 'publication_order'; 我有一个表单'pub_form',它具有函数$ form ['#theme'] ='publication_order';
so in module file, i defined function theme_publication_order($element), but the function was not called. 因此,在模块文件中,我定义了函数theme_publication_order($ element),但未调用该函数。
i have search the google, looks like i have to use hook_theme() to make theme_publication_order() to work. 我已经搜索了谷歌,看起来我必须使用hook_theme()来使theme_publication_order()起作用。
how can i override hook_theme() to make it work? 我如何覆盖hook_theme()使其起作用?
To make a theme function work, you must first define it in an implementation of hook_theme. 要使主题函数起作用,必须首先在hook_theme的实现中对其进行定义。 You need this, to let drupal know the function exists.
您需要这样做,以使Drupal知道该功能存在。 This would look like this:
看起来像这样:
function mymodule_theme() {
$items = array();
$items['publication_order'] = array(
'arguments' => array('element' => NULL),
);
return $items;
}
Then drupal will know about your theme function: 然后drupal将了解您的主题功能:
function theme_publication_order($element) {
// do your stuff here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.