Commit 5f635b95 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#205075 report by ktabuer, patch by myself, testing by ktauber and Lynn: book...

#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)
parent 1279630a
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment