Closed (fixed)
Project:
Printer, email and PDF versions
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2010 at 23:38 UTC
Updated:
16 Apr 2013 at 19:34 UTC
Jump to comment: Most recent file
Comments
Comment #1
jcnventuraThe module is now calling the correct page preprocess functions, but that info is only processed after the print['scripts'] variable has been defined.. jquery_update tries (and succeed) in deferring this to the very end, even after the module has run..
The solution for this is something that has been on my mind for some time: make the print.tpl.php file a lot more like the Drupal page.tpl template and get rid of all the hard-coded HTML in the module.. However, this will break compatibility with existing templates.. This is one of the things I want to tackle in the near future.
Comment #2
ydx commentedhello, jcnventura.
I use Custom Node Template to set serveral styles of node, but when I click print button it just give me the original node view,anyidea, thanks?
Comment #3
jcnventuraFinally, made the template a real template.. The scripts variable is now set at hook_preprocess_X() time, so if the jquery update is fixable, this triple-bypass surgery I just completed on the core of the module should do it.
Comment #5
theunraveler commentedHere's a patch that fixes this issue for 7.x-1.x.
Comment #6
grndlvl commentedRe-rolled as relative path.
Comment #7
David_Rothstein commentedI'm not sure what that drupal_add_js() call does... isn't it a no-op?
But the patch seems to work (I think because in Drupal 7, core JavaScript happens to get added on pretty much every page load already anyway).
Comment #8
theunraveler commentedActually, the core JS files are loaded on the first call to
drupal_add_js(), so I think this is just ensuring that those are added before inlining the send to printer JS.Comment #9
David_Rothstein commentedThat only happens if you pass something in as the first parameter of drupal_add_js(). Otherwise it looks to me like it does nothing.
My guess is that #1279226: jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page is what's making this work, but either way, it seems to :)