function print_generate_book in Printer, email and PDF versions 5.2
Outputs a printer-friendly page. Used for book pages
1 call to print_generate_book()
- print_controller in ./
print.module - Print module path catcher
File
- ./
print.module, line 756 - Display printer-friendly versions of Drupal pages
Code
function print_generate_book($nid) {
global $base_url;
$node = node_load(array(
'nid' => $nid,
));
if (!node_access('view', $node) || !user_access('see printer-friendly version')) {
// Access is denied
return drupal_access_denied();
}
$depth = count(book_location($node)) + 1;
$node->body = book_recurse($nid, $depth, 'book_node_visitor_html_pre', 'book_node_visitor_html_post');
// Convert the a href elements
$pattern = "@<(a\\s[^>]*?)>(.*?)</a>@is";
$node->body = preg_replace_callback($pattern, "print_rewrite_urls", $node->body);
init_theme();
$print = _print_var_generator($node);
// The title is already displayed by the book_recurse, so avoid duplication
$print["title"] = "";
include_once print_get_template($node->type);
}