book_node_visitor_html_pre

Versions
4.7 – 5
book_node_visitor_html_pre($node, $depth, $nid)

Generates printer-friendly HTML for a node. This function is a 'pre-node' visitor function for book_recurse().

Parameters

$node

  • the node to generate output for.

$depth

  • the depth of the given node in the hierarchy. This

is used only for generating output.

$nid

  • the node id (nid) of the given node. This

is used only for generating output.

Return value

  • the HTML generated for the given node.

▾ 1 function calls book_node_visitor_html_pre()

book_recurse in modules/book.module
Traverses the book tree. Applies the $visit_pre() callback to each node, is called recursively for each child of the node (in weight, title order). Finally appends the output of the $visit_post() callback to the output before returning the generated...

Code

modules/book.module, line 803

<?php
function book_node_visitor_html_pre($node, $depth, $nid) {
  // Output the content:
  if (node_hook($node, 'content')) {
    $node = node_invoke($node, 'content');
  }
  // Allow modules to change $node->body before viewing.
  node_invoke_nodeapi($node, 'print', $node->body, false);

  $output .= "<div id=\"node-". $node->nid ."\" class=\"section-$depth\">\n";
  $output .= "<h1 class=\"book-heading\">". check_plain($node->title) ."</h1>\n";

  if ($node->body) {
    $output .= $node->body;
  }
  return $output;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.