Views custom templates inside feature module

Public

Source: https://www.deeson.co.uk/labs/views-templates-features-module

</> CopyGet raw version
php
  1. /**
  2. * Implements hook_views_api_alter().
  3. *
  4. * Views api is specified by features but we want to add the views-template directory to it.
  5. */
  6. function mymodule_views_api_alter(&$apis) {
  7. if (!empty($apis['mymodule']) && $apis['mymodule']['api'] == '3.0') {
  8. $apis['mymodule']['template path'] = drupal_get_path('module', 'mymodule') . '/views-templates';
  9. }
  10. }