From 5f635b95857efc7da3dc6ce9f9abbdb1f8e208e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Wed, 2 Jan 2008 11:36:19 +0000 Subject: #205075 report by ktabuer, patch by myself, testing by ktauber and Lynn: book block throws notice when used on non-book-node page (with a little bit of code cleanup) --- modules/book/book.module | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/book/book.module b/modules/book/book.module index 37507465e..c9215e191 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -181,12 +181,11 @@ function book_block($op = 'list', $delta = 0, $edit = array()) { $block[0]['cache'] = BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE; return $block; case 'view': - if (arg(0) == 'node' && is_numeric(arg(1))) { - $node = node_load(arg(1)); + $current_bid = 0; + if ($node = menu_get_object()) { + $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid']; } - $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid']; - $mode = variable_get('book_block_mode', 'all pages'); - if ($mode == 'all pages') { + if (variable_get('book_block_mode', 'all pages') == 'all pages') { $block['subject'] = t('Book navigation'); $book_menus = array(); $pseudo_tree = array(0 => array('below' => FALSE)); -- cgit v1.2.3