diff --git a/modules/block/block.module b/modules/block/block.module index d0f07e447ba5a531a1fe592985d00e61df089043..920090f82241876f8e274be1392bc611a424f8a0 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -850,7 +850,7 @@ function _block_get_renderable_block($element) { // hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter(). drupal_alter(array('block_view', "block_view_{$block->module}_{$block->delta}"), $array, $block); - if (empty($array)) { + if (empty($array['content'])) { // Blocks without content should emit no markup at all. $element += array( '#access' => FALSE, diff --git a/modules/block/block.test b/modules/block/block.test index a6ab2bf3fe8ccb8ac755c26adf677f48b8e75178..0b41be52ef39614afd25797be6a38052cf0dba91 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -190,6 +190,9 @@ class BlockTestCase extends DrupalWebTestCase { $this->drupalLogout(); $this->drupalGet(''); $this->assertNoText($title, t('Block was not displayed to anonymous users.')); + + // Confirm that an empty block is not displayed. + $this->assertNoRaw('block-system-help', t('Empty block not displayed.')); } /** diff --git a/modules/book/book.module b/modules/book/book.module index 6e74d3297efcaec7c45eb510d63543c9460e43d0..779c90704eed4e3de8303d43bffd52ed3169eb02 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -274,8 +274,9 @@ function book_block_view($delta = '') { $book_menus[$book_id] = menu_tree_output($pseudo_tree); } } - $book_menus['#theme'] = 'book_all_books_block'; - $block['content'] = $book_menus; + if ($block['content'] = $book_menus) { + $book_menus['#theme'] = 'book_all_books_block'; + } } elseif ($current_bid) { // Only display this block when the user is browsing a book.