book_export_traverse

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 book_export_traverse($tree, $visit_func)

Traverse the book tree to build printable or exportable output.

During the traversal, the $visit_func() callback is applied to each node, and is called recursively for each child of the node (in weight, title order).

Übergabeparameter

$tree A subtree of the book menu hierarchy, rooted at the current page.

$visit_func A function callback to be called upon visiting a node in the tree.

Rückgabewert

The output generated in visiting each node.

▾ 2 functions call book_export_traverse()

book_export_html in modules/book/book.pages.inc
This function is called by book_export() to generate HTML for export.
book_export_traverse in modules/book/book.module
Traverse the book tree to build printable or exportable output.

Code

modules/book/book.module, line 906

<?php
function book_export_traverse($tree, $visit_func) {
  $output = '';

  foreach ($tree as $data) {
    // Note- access checking is already performed when building the tree.
    if ($node = node_load($data['link']['nid'], FALSE)) {
      $children = '';
      if ($data['below']) {
        $children = book_export_traverse($data['below'], $visit_func);
      }

      if (function_exists($visit_func)) {
        $output .= call_user_func($visit_func, $node, $children);
      }
      else {
        // Use the default function.
        $output .= book_node_export($node, $children);
      }
    }
  }
  return $output;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen