Providing node templates in a module directory

From ceejayoz

Jump to: navigation, search

This will allow your Drupal module to provide node templates in its directory. Useful when you want to provide custom node templates for a core theme like Garland without having to fork the Garland directory to do so.

function mymodule_theme_registry_alter(&$theme_registry) {
  $theme_hook = 'node';
  $modulepath = drupal_get_path('module', 'mymodule');
  array_unshift($theme_registry[$theme_hook]['theme paths'], $modulepath);
}
Personal tools