Closed (fixed)
Project:
Printer, email and PDF versions
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 May 2012 at 13:59 UTC
Updated:
6 Jun 2012 at 01:11 UTC
For the pages that aren't node pages. Drupal can't replace the tokens in "PDF File Name" in this case.
| Comment | File | Size | Author |
|---|---|---|---|
| print_pdf_alter.patch | 508 bytes | jorisdejong |
Comments
Comment #1
jcnventuraAre you using the latest dev? The fix for #1543004: PDF filename with token solved this in part, as long as the configured filename doesn't include node-specific tokens.
Comment #2
rudiedirkx commentedI've experienced this as well. I've fixed it with a
drupal_altertoo. Perfect solution IMO. Last, absolute control over the filename, separate from tokens. Maybe the filename comes from something programmatic that you can fetch from the node or something else from$path. This allows absolute control.One
drupal_alteris cheap. Do it =)I had solved the issue the exact same way, so it's reviewed. (I don't know if it'll patch though.)
Comment #3
jcnventuraThe $path variable may be empty and it would be nice to use $node object, if that's available..
Comment #4
rudiedirkx commentedIf the path is a node path, you can get the node object the way print_pdf does it, or better even: with
menu_get_object. There's only 1 constant at all times:$path. Not any entity object and even less likeky a node.Only passing a node object definitely isn't enough. A (context) assoc array with 'node' and 'path' might be good as 3rd arg to drupal_alter. I'd be (more) content with just
$path.I don't see how
$pathwould ever be empty..?Everypage has a URI. The front page too. Views too. Etc.Comment #5
jcnventuraThe way the module works, it's either called with path (non-nodes) or with a node.. In the latter case, path is empty.
Comment #6
jcnventuraDisregard my last comment.. The only way for path to be empty is when calling the module to print the site's frontpage.
Taking that into account, I've committed the patch by jorisdejong to the devs.