Posted by tce on December 5, 2012 at 4:06pm
I think I'm being a bit thick, but I can't get my theme (a sub theme of Bartik) to override the template in my module.
In my module I've registered the theme template:
<?php
/**
* Implements hook_theme().
*/
function blah_theme($existing, $type, $theme, $path) {
return array(
'blah_my_template' => array(
'render element' => 'elements',
'template' => 'my-template',
'path' => drupal_get_path('module', 'blah') . '/templates',
),
);
}
?>my template name is my-template.tpl.php and that is in my module, in a folder called templates. I copied this template and put into my themes templates folder, but it doesn't override, the output is coming from the template in my module. I've cleared caches, I'm even rebuilding the registry ever page load.
Anyone got any ideas?
Comments
Typical, I spend a long time
Typical, I spend a long time trying to figure out the problem, but as soon as I post on Drupal I find the answer within 5 minutes.
Apparently it's a bug:
http://drupal.org/node/342350
I renamed my template file to the name of the key (converting underscores to hyphen) and voilà, it works.
<?php/**
* Implements hook_theme().
*/
function blah_theme($existing, $type, $theme, $path) {
return array(
'blah_my_template' => array(
'render element' => 'elements',
'template' => 'blah-my-template', // changed this
'path' => drupal_get_path('module', 'blah') . '/templates',
),
);
}
?>