I'm trying to develop a module whose output is to be themable in a way very similar to that of the Views module, but I can't seem to get it to work. I've followed Using the Theme Layer (http://drupal.org/node/933976) and searched the drupal forums to no avail.
The theme hook is defined in hook_theme as
'beerxml_hop' => array (
'template' => 'beerxml-hop',
'render element' => 'beerxml',
'pattern' => 'beerxml_hop__',
'path' => drupal_get_path('module', 'beerxml_formatter') . '/templates',
)
And I invoke the theme hook by
print render($element);
in node--beer.tpl.php (beer is the content type name) where $element is a render array with #theme
array(3) {
[0] => string(19) "beerxml_hop__simcoe"
[1] => string(11) "beerxml_hop"
[2] => string(15) "beerxml_unknown"
}
The template that gets invoked is beerxml_hop, and not beerxml_hop__simcoe as I would have hoped. Both beerxml-hop--simcoe.tpl.php and beerxml-unknown.tpl.php exists in the same directory as beerxml-hop.tpl.php and beerxml-unknown.tpl.php gets used elsewhere in the output.
What am I missing? :)