From 3b27048623d7d06db876599e497f0187510c044a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 9 Feb 2006 07:27:11 +0000 Subject: - Patch #47098 by JonBob: fixed book navigation divs when book has no child pages. --- modules/book.module | 22 +++++++++++++--------- modules/book/book.module | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'modules') 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 .= '
'; - - 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 .= ''; - $output .= '
'; + if (isset($tree) || isset($links)) { + $output = '
'; + if (isset($tree)) { + $output .= $tree; + } + if (isset($links)) { + $output .= ''; + } + $output .= '
'; + } } 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 .= '
'; - - 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 .= ''; - $output .= '
'; + if (isset($tree) || isset($links)) { + $output = '
'; + if (isset($tree)) { + $output .= $tree; + } + if (isset($links)) { + $output .= ''; + } + $output .= '
'; + } } return $output; -- cgit v1.2.3