Skip to content

Instantly share code, notes, and snippets.

@jasonglisson
Last active September 14, 2017 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonglisson/f0ee7ccea6d286fbd330 to your computer and use it in GitHub Desktop.
Save jasonglisson/f0ee7ccea6d286fbd330 to your computer and use it in GitHub Desktop.
Drupal 7 - Have module load in views templates
function NAME_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'NAME'),
'template path' => drupal_get_path('module', 'NAME'),
);
}
This will tell Views to look in the root directory of your module. I personally am a fan of adding a subdirectory to the module to hold template files. To do this append the directory name to the end of the template path, eg:
'template path' => drupal_get_path('module', 'NAME') . '/templates',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment