#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)

6.x
Gábor Hojtsy 2008-01-02 11:36:19 +00:00
parent 1279630a3a
commit 5f635b9585
1 changed files with 4 additions and 5 deletions

View File

@ -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));