From c2d394427331ccb6e1fb075119f5756a1d650034 Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Fri, 29 Dec 2006 07:41:44 +0000 Subject: #100963 by Eaton. Use new pattern for node rendering in printer-friendly version. --- modules/book/book.module | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/book/book.module b/modules/book/book.module index c56725f3c..f8b8903e8 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -716,6 +716,8 @@ function theme_book_export_html($title, $content) { * title order). Finally appends the output of the $visit_post() * callback to the output before returning the generated output. * + * @todo This is duplicitous with node_build_content(). + * * @param nid * - the node id (nid) of the root node of the book hierarchy. * @param depth @@ -778,19 +780,25 @@ function book_recurse($nid = 0, $depth = 1, $visit_pre, $visit_post) { * - the HTML generated for the given node. */ function book_node_visitor_html_pre($node, $depth, $nid) { - // Output the content: - if (node_hook($node, 'content')) { - $node = node_invoke($node, 'content'); + // Remove the delimiter (if any) that separates the teaser from the body. + $node->body = str_replace('', '', $node->body); + + // The 'view' hook can be implemented to overwrite the default function + // to display nodes. + if (node_hook($node, 'view')) { + $node = node_invoke($node, 'view', FALSE, FALSE); + } + else { + $node = node_prepare($node, FALSE); } - // Allow modules to change $node->body before viewing. - node_invoke_nodeapi($node, 'print', $node->body, FALSE); + + // Allow modules to make their own additions to the node. + node_invoke_nodeapi($node, 'print'); $output .= "
nid ."\" class=\"section-$depth\">\n"; $output .= "

". check_plain($node->title) ."

\n"; + $output .= drupal_render($node->content); - if ($node->body) { - $output .= drupal_render($node->content); - } return $output; } -- cgit v1.2.3