summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrockfanning2016-12-13 14:45:21 (GMT)
committerJoao Ventura2016-12-13 14:45:21 (GMT)
commit769828beaa603002ae3d7cd731ccf966b67ae0ea (patch)
tree793d409d2cefdb2c9f41a7e9f31f5fa80dc51874
parentbdad10a7485f66193c96a8e5959743669fe42296 (diff)
Issue #565856 by bradjones1, ayalon, brockfanning, jcnventura: Can Panel pages be sent to PDF for rendering?
-rw-r--r--print.admin.inc7
-rw-r--r--print.module1
-rw-r--r--print.pages.inc9
3 files changed, 13 insertions, 4 deletions
diff --git a/print.admin.inc b/print.admin.inc
index 7e4dfc0..eee2040 100644
--- a/print.admin.inc
+++ b/print.admin.inc
@@ -77,6 +77,13 @@ function print_main_settings() {
'#description' => t('When this option is active, user comments are also included in the printer-friendly version. Requires the comment module.'),
);
+ $form['settings']['print_node_router'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Consult menu router for node display handler'),
+ '#default_value' => variable_get('print_node_router', PRINT_NODE_ROUTER_DEFAULT),
+ '#description' => t('When this option is active, print module will check the menu router for the handler to consult for page contents at node/%node.'),
+ );
+
$form['settings']['print_newwindow'] = array(
'#type' => 'radios',
'#title' => t('New window method'),
diff --git a/print.module b/print.module
index 1f64414..88c61fd 100644
--- a/print.module
+++ b/print.module
@@ -21,6 +21,7 @@ define('PRINT_KEEP_THEME_CSS_DEFAULT', 0);
define('PRINT_URLS_DEFAULT', 1);
define('PRINT_URLS_ANCHORS_DEFAULT', 0);
define('PRINT_COMMENTS_DEFAULT', 0);
+define('PRINT_NODE_ROUTER_DEFAULT', 0);
define('PRINT_NEWWINDOW_DEFAULT', 1);
define('PRINT_TYPE_URLLIST_DEFAULT', 1);
diff --git a/print.pages.inc b/print.pages.inc
index b5052d6..b3e1657 100644
--- a/print.pages.inc
+++ b/print.pages.inc
@@ -92,12 +92,13 @@ function print_controller($path, $format, $cid = NULL, $view_mode = PRINT_VIEW_M
$path = $alias;
}
$parts = explode('/', $path);
- if (($parts[0] == 'node') && (count($parts) > 1) && ctype_digit($parts[1])) {
+ $node_router = variable_get('print_node_router', FALSE);
+ if (($parts[0] == 'node') && (count($parts) > 1) && ctype_digit($parts[1]) && !$node_router) {
array_shift($parts);
$path = implode('/', $parts);
}
$revision_view = preg_match('!^[\d]*/revisions/[\d]*/view$!', $path);
- if (ctype_digit($parts[0]) && ((count($parts) == 1) || $revision_view)) {
+ if (ctype_digit($parts[0]) && ((count($parts) == 1) || $revision_view) && !$node_router) {
$vid = $revision_view ? $parts[2] : NULL;
$node = _print_generate_node($path, $format, $vid, $cid, $view_mode);
}
@@ -702,9 +703,9 @@ function _print_generate_node($nid, $format, $vid = NULL, $cid = NULL, $view_mod
function _print_generate_path($path, $format) {
global $_print_urls;
- // Handle node tabs.
+ // Handle node tabs, or cases where the 'node_router' option is enabled.
$parts = explode('/', $path);
- if (ctype_digit($parts[0]) && (count($parts) > 1)) {
+ if (ctype_digit($parts[0]) && ((count($parts) > 1) || variable_get('print_node_router', FALSE))) {
$path = 'node/' . $path;
}