From: Joao Ventura Date: Sun, 17 Jul 2011 18:35:02 +0000 (+0200) Subject: Issue #1044138: fix PDF filename token replacement. X-Git-Tag: 7.x-1.0-alpha1~10 X-Git-Url: http://drupalcode.org/project/print.git/commitdiff_plain/4034f91c143cf36b539a484e9e43b4e41cba8e0a Issue #1044138: fix PDF filename token replacement. --- diff --git a/print_pdf/print_pdf.pages.inc b/print_pdf/print_pdf.pages.inc index 29443e3..7787efd 100644 --- a/print_pdf/print_pdf.pages.inc +++ b/print_pdf/print_pdf.pages.inc @@ -29,6 +29,19 @@ function print_pdf_controller() { $path = implode('/', $args); $cid = isset($_GET['comment']) ? (int)$_GET['comment'] : NULL; + if (ctype_digit($args[0])) { + if (drupal_lookup_path('source', $path)) { + // This is a numeric alias + $path = drupal_get_normal_path($path); + $path_arr = explode('/', $path); + $node = node_load($path_arr[1]); + } + else { + // normal nid + $node = node_load($args[0]); + } + } + $pdf_filename = variable_get('print_pdf_filename', PRINT_PDF_FILENAME_DEFAULT); if (!empty($pdf_filename)) { $pdf_filename = token_replace($pdf_filename, array('node' => $node)) . '.pdf';