开发者

theme form on drupal 6

I have a form 'pub_form' which has function $form['#theme'] = 'publication_order';

so in module file, i defined function theme_publication_order($element), but the function was not called.

i have search the google, looks like i have t开发者_运维问答o use hook_theme() to make theme_publication_order() to work.

how can i override hook_theme() to make it work?


To make a theme function work, you must first define it in an implementation of hook_theme. You need this, to let drupal know the function exists. 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:

function theme_publication_order($element) {
// do your stuff here
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜