Can I override the theme function with a .tpl file?
How do I get around overriding the theme function with a file .tpl
? I know how to override the .tpl
theme function file , but not the other way around. I can't seem to find anywhere that tells me this, so maybe this is not possible or not a good practice.
For example, if there was a theme function defined in a module called super_results
and registered in the registry by a theme like the example below, how could I get around this with super_results.tpl.php
.
'super_results' => array(
'arguments' => array('title' => NULL, 'results' => NULL, 'votes' => NULL),
),
function modulename_super_results($title, $results,$votes){ output HTML }
a source to share
The simplest solution would probably be to create a new theming function that uses a template. Something like this should work, disclaimer untested.
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);
}
a source to share