I am using webform, and am trying to create a printer friendly version of the webform confirmation page.
The webform node is 45 and the node type according to the database is webform
I'm having a problem getting the custom print template suggestion to work in the themes directory.
If I try (in the themes directory)
print.tpl.php - works
print--html.tpl.php - works
However, nothing below works (it is just ignored and the modules default print.tpl.php fires):
print--node--webform.tpl.php
print--node--webform--45.tpl.php
print--html--node--webform.tpl.php
print--html--node--webform--45.tpl.php
I'm not sure where to go from here.
Comments
Comment #1
jcnventuraDid you clear the caches everytime you renamed the files?
Comment #2
jmoyles commentedJust tried that - no change in behavior
Comment #3
jcnventuraSorry, I only read your original post in detail now.. The webform confirmation page is not a node, and thus can't be themed like that..
The page at yoursite.com/node/45 (which would be the unfilled webform), is indeed a node and will should obey the above templates.
However, the confirmation page is something generated by the webform module (not a node) and can only be 'themed' using one of the two templates which you've already seen working.
If you really need to handle a webform confimation page differently than the rest, you'll need to modify the print[--html].tpl.php file to detect and handle that case separate from the normal pages.
Comment #4
jmoyles commentedUnderstood - thanks for looking into this as it's really not a "you" problem, but instead a side effect of Webforms.
Quick Q, and this may be answered elsewhere - is there a hook (preprocess or otherwise) that you are aware of that I can modify to catch this case and add in appropriate template suggestion in the print module and/or core? Again, not your job to teach me Drupal, but it looks like you've done some work in the template suggestion arena.
Comment #5
jcnventuraBetter ask the webform maintainer if he provided any such hook.
Comment #6
jmoyles commentedWill do, thanks J.
Closing until I figure out whether or not I need help to execute on this.
Comment #7
jmoyles commentedFYI for anyone stumbling across this thread:
I didn't see anything that would allow me to catch and act on a print template suggestion in webforms, so I did as jcnventura recommended and turned my theme print.tpl.php into a template broker for webforms.
Comment #8
jmoyles commentedDug around a little more. Came up with this solution to allow print template suggestions for non standard nodes (like the webform confirmation page).
By using THEME_process_HOOK, I can fire actions after function print_preprocess_print (print.pages.inc) from the print module (this is worth a read: http://api.drupal.org/api/drupal/includes%21theme.inc/function/theme/7 )
Armed with this knowledge, I created the following two new functions in the theme template.tpl.php file (note this is for the site I am working on, and may not work in all circumstances):
Comment #9
jmoyles commentedFor above, replace THEME with your theme, also you don't need to do anything to have this fire - it will process automatically.
Comment #10
Tronux commentedFor confirmation pages: webform-confirmation-590.tpl.php
Change the 590 to your specifiq webform nid.