By kuldeepkaundal on
Hi,
I am using following code to theme forms in my module:
Mymodule_theme($existing, $type, $theme, $path) {
return array(
'mymodule_form' => array(
'arguments' => array('form' => NULL),
'template' => 'registration',
);
}
Then i can theme this form by placing a template file "registration" in my module itself.
But, i have got some hook in my module that doesn't have a form, its just a simple hook:
Mymodule_cpsuccess(){
drupal_set_message('hi');
}
I want to specify a template for this hook and want to theme it using that template, please suggest me a way to achive this.
Regards,
Kul.
Comments
Re: Theming a function in a module
Hi Kul:
I'm not entirely sure what you are trying to do here, but if you just want to make your function theme-overrideable (so you can implement phptemplate_cpusucess() later to override the way it looks) you can just add another entry to your hook_theme's return data:
Then, somewhere in your code, you add your theme callback:
And then you would modify your function like this:
You could, of course, pass the message as an argument if that's the sort of functionality you are looking for.
I hope that was helpful.
Cheers,
Steve