I can't figure out how to correctly implement the theme mechanism in my module. The hook just doesn't get called, after flushing registry ofc.
My mymodule.module contains a function (this function gets called, no problem, I give it just for illustration):
function mymodule_node_view($node, $view_mode) {
...
$node->content['mymodule_tocteasers'] = array(
'#markup' => theme('tocteasers', array('tocteasers' => "whatever")),
);
}
As I understand the theme mechanism, in order to render tocteasers
hook, the module should implement it. Here is my module's implementation, which is not called at all, ever:
function template_preprocess_tocteasers(&$variables) {
$variables['content'] = "something!!!";
dsm($variables); print "hello";
}
^^I also tried function mymodule_preprocess_tocteasers(&$variables)
without success
In addition, I have a file named tocteasers.tpl.php in my module directory, containing:
<div>
<?php print "!!"; ?>
<?php print $content; ?>
</div>
This also does not get printed or called.
Can someone plese advise me, how to make this implementation so that the tocteasers.tpl.php file is used and gets the $content variable as intended?
hook_theme()
implementation? – Clive♦ Mar 20 '12 at 10:04