Closed (fixed)
Project:
Printer, email and PDF versions
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2009 at 07:11 UTC
Updated:
4 Apr 2012 at 16:40 UTC
I have a paginated report with links that I want to be unpaginated and without links if it's being printed as a PDF. I thought I could do a simple boolean check for whether or not arg(0) was printpdf but that won't work because _print_generate_path() does a menu_set_active() which tricks Drupal into thinking I'm on the page that's being printed. I struggled with this for 20 minutes and finally resorted to checking $_SERVER['REQUEST_URI'] since that was the only place I could find the "true" path.
It'd be lovely if there was some extra context that was passed in so that I could easily switch on that.
Comments
Comment #1
jcnventuraCheck for $node->build_mode == 'print'.
João
Comment #3
ludo.rHi,
I'm currently working in
template_preprocess_page(), and I have to find out if the node is being printed.There is no more $node->build_mode (or at least I don't see it in
template_preprocess_page()).Using
arg()or$_GET['q']always return 'node/123' instead of 'print /123'.Does one have a solution on this issue?
Thanks!
Comment #4
jcnventuraDon't open closed issues please..
The build mode is gone in 7.x, but Drupal now supports something called the view_mode. Unfortunately it's only defined at node level, so I'm not sure if you'll get it in template_preprocess_page().
Comment #5
ludo.rSorry, for re-opening.
You're right about preprocess_page() and preprocess_node().
But I've found a way to determine if the node is being printed :