views:

86

answers:

1

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 to use hook_theme() to make theme_publication_order() to work.

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

+1  A: 

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
}
googletorp

related questions