Hi,

I found out that it is possible to create a print--pdf.tpl.php file which will be used whenever content is printed out as PDF. My problem is that I need to print out various pages which are no nodes but custom module paths. As it is possible to create page.tpl.php files for each content types and even for specific nodes I wonder how I could implement addtional theme suggestions. Can I use hook_preprocess_print(&$variables) in my module or template.php file? I tried to but did not success - I am not sure if I made a mistake or if it is not possible in general?!

Best,
Tobias

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

freality’s picture

Looks like print_preprocess_print is overwriting any changes to $variables['theme_hook_suggestions'].

Here's a patch to fix that.

tobiberlin’s picture

works... thank you!

Anybody’s picture

Status: Active » Needs review

Hey, I need the same thing and think it would make a lot of sense to put this into the stable release for more flexibility?

What do you think about it? It seems to work really fine! I'll set this "Needs review".

ckng’s picture

Title: print.tpl.php for a specific path/ format combination? » theme_hook_suggestions overwritten
Version: 7.x-2.0 » 7.x-2.x-dev
Category: Feature request » Bug report
Status: Needs review » Reviewed & tested by the community

Patch #1 solves hook_preprocess_print() not called as well.

asherry’s picture

This ticket is old but the patch still applies cleanly, and is needed by a project we have running. Committing this would be greatly appreciated.

  • jcnventura committed 49347c7 on 7.x-2.x authored by freality
    Issue #2276407 by freality: theme_hook_suggestions overwritten
    
jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.