diff --git a/print.admin.inc b/print.admin.inc index 7e4dfc0010507e7afd896d3f36ebcb30fbf8d234..eee2040af2e39433e3d60daa4e8bd38ea6c8e06c 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 1f6441436537a5e91e5637c6afad2d9ccc84533b..88c61fdaada9f37f21158d42bcfed64eba6ffbf7 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 b5052d6bf12345ccda8cc16f0b502c76791f49c1..b3e165762d5c09ae9b29eb9139c0f004e5829516 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; }