Articles


How to assign a print tpl for specific page in Drupal 7.

How to assign a print tpl for specific page in Drupal 7.



Posted byvarghese.t,16th Nov 2016

We usually assign tpl through theme_hook_suggestions in hook_preprocess_page. Print page will not trigger hook_preprocess_page it will trigger hook_preprocess_print. But in print module they initializing theme_hook_suggestions. So if we altered theme_hook_suggestions in hook_preprocess_print also not work. The solution is we have to do in hook_process_print example

 function modulename_process_print(&$variables, $hook) { if(arg(0) == 'our_specific_page') { $variables['theme_hook_suggestions'][] = 'print__our_specific_page'; } } 

 

Categories