I create a module using hook_preprocess_node () I created a new view mode for the node object called 'vacancy_teaser' using hook_entity_info_alter ()
this is displayed in the node display settings and displayed
so I want to use the template included in my module when this view mode is used.
my code is:
function vacancies_preprocess_node(&$vars) { if($vars['view_mode'] == 'vacancy_teaser') { $vars['theme_hook_suggestions'][] = 'node_vacancy_teaser'; } }
my template file is called: 'node -vacancy-teaser.tpl.php', but not used in the view of my view $vars['view_mode'] == 'vacancy_teaser'
in the view. (verified)
but where is $vars['theme_hook_suggestions'][] = 'node_vacancy_teaser';
looking for a template file? somehow it did not turn on / was not used.
apparently, in drupal 7, dubble underscores are required for some reason. node_vacatures_vacancy_teaser.tpl.php placed in the active templates folder seems to do the trick ... although I don't think this is a neat solution, since the tpl.php file is separate from the module.
source share