| 5 book.module | theme_book_navigation( |
| 6 theme.php | theme_book_navigation() |
| 7 theme.php | theme_book_navigation($variables) |
| 8 theme.php | theme_book_navigation($variables) |
Prepares both the custom breadcrumb trail and the forward/backward navigation for a node presented as a book page.
Related topics
1 theme call to theme_book_navigation()
File
- modules/
book.module, line 442 - Allows users to collaboratively author a book.
Code
function theme_book_navigation($node) {
$path = book_location($node);
// Construct the breadcrumb:
$node->breadcrumb = array(); // Overwrite the trail with a book trail.
foreach ($path as $level) {
$node->breadcrumb[] = array(
'path' => 'node/' . $level->nid,
'title' => $level->title,
);
}
$node->breadcrumb[] = array('path' => 'node/' . $node->nid);
if ($node->nid) {
$output .= '<div class="book">';
if ($tree = book_tree($node->nid)) {
$output .= '<div class="tree">' . $tree . '</div>';
}
if ($prev = book_prev($node)) {
$links .= '<div class="prev">';
$links .= l(t('previous'), 'node/' . $prev->nid, array('title' => t('View the previous page.')));
$links .= '</div>';
$titles .= '<div class="prev">' . check_plain($prev->title) . '</div>';
}
else {
$links .= '<div class="prev"> </div>'; // Make an empty div to fill the space.
}
if ($next = book_next($node)) {
$links .= '<div class="next">';
$links .= l(t('next'), 'node/' . $next->nid, array('title' => t('View the next page.')));
$links .= '</div>';
$titles .= '<div class="next">' . check_plain($next->title) . '</div>';
}
else {
$links .= '<div class="next"> </div>'; // Make an empty div to fill the space.
}
if ($node->parent) {
$links .= '<div class="up">';
$links .= l(t('up'), 'node/' . $node->parent, array('title' => t('View this page\'s parent section.')));
$links .= '</div>';
}
$output .= '<div class="nav">';
$output .= ' <div class="links">' . $links . '</div>';
$output .= ' <div class="titles">' . $titles . '</div>';
$output .= '</div>';
$output .= '</div>';
}
$node->body = $node->body . $output;
return $node;
}
Login or register to post comments