I have a module and a theme with different names. The module implements hook_theme() to specify a group of templates with 'template' and 'variables' for each. Template files in the module are working as intended.

In my theme, I implement templates/html.tpl.php and templates/page.tpl.php - which both work. But, theme/templates/mytemplate.tpl.php is not overriding the module's template. I have cleared the cache.

What do I have to do so that templates in my theme's templates/ folder will override my own module's templates?

1 Answer 1


I found the answer in this comment. For Drupal to find the theme's template overrides, I had to change my theme keys to underscore versions of my dashed template names.

function mymodule_theme($existing, $type, $theme, $path)
  return array(

    'my_theme_key' => array(
      'template' => 'my-theme-key',
      'variables' => array(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.