diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-02-09 07:27:11 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-02-09 07:27:11 +0000 |
commit | 3b27048623d7d06db876599e497f0187510c044a (patch) | |
tree | c632f79e63f51fe27b4d7d629c9835fbf711f61a | |
parent | 6b706b50b3d5ee52f72ec2ad82b4e0b793179499 (diff) | |
download | brdo-3b27048623d7d06db876599e497f0187510c044a.tar.gz brdo-3b27048623d7d06db876599e497f0187510c044a.tar.bz2 |
- Patch #47098 by JonBob: fixed book navigation divs when book has no child pages.
-rw-r--r-- | modules/book.module | 22 | ||||
-rw-r--r-- | modules/book/book.module | 22 |
2 files changed, 26 insertions, 18 deletions
diff --git a/modules/book.module b/modules/book.module index 250d8e4f6..8d214dec7 100644 --- a/modules/book.module +++ b/modules/book.module @@ -480,15 +480,11 @@ function theme_book_navigation($node) { $output = ''; if ($node->nid) { - $output .= '<div class="book-navigation">'; - - if ($tree = book_tree($node->nid)) { - $output .= $tree; - } + $tree = book_tree($node->nid); if ($prev = book_prev($node)) { drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid))); - $links .= l(t('‹ ') . check_plain($prev->title), 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); + $links .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); } if ($node->parent) { drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); @@ -496,11 +492,19 @@ function theme_book_navigation($node) { } if ($next = book_next($node)) { drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid))); - $links .= l(check_plain($next->title) . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); + $links .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); } - $output .= '<div class="page-links">'. $links .'</div>'; - $output .= '</div>'; + if (isset($tree) || isset($links)) { + $output = '<div class="book-navigation">'; + if (isset($tree)) { + $output .= $tree; + } + if (isset($links)) { + $output .= '<div class="page-links">'. $links .'</div>'; + } + $output .= '</div>'; + } } return $output; diff --git a/modules/book/book.module b/modules/book/book.module index 250d8e4f6..8d214dec7 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -480,15 +480,11 @@ function theme_book_navigation($node) { $output = ''; if ($node->nid) { - $output .= '<div class="book-navigation">'; - - if ($tree = book_tree($node->nid)) { - $output .= $tree; - } + $tree = book_tree($node->nid); if ($prev = book_prev($node)) { drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid))); - $links .= l(t('‹ ') . check_plain($prev->title), 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); + $links .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); } if ($node->parent) { drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); @@ -496,11 +492,19 @@ function theme_book_navigation($node) { } if ($next = book_next($node)) { drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid))); - $links .= l(check_plain($next->title) . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); + $links .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); } - $output .= '<div class="page-links">'. $links .'</div>'; - $output .= '</div>'; + if (isset($tree) || isset($links)) { + $output = '<div class="book-navigation">'; + if (isset($tree)) { + $output .= $tree; + } + if (isset($links)) { + $output .= '<div class="page-links">'. $links .'</div>'; + } + $output .= '</div>'; + } } return $output; |