diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/block/block.module | 31 | ||||
-rw-r--r-- | modules/block/block.test | 26 | ||||
-rw-r--r-- | modules/system/system.admin.inc | 7 | ||||
-rw-r--r-- | modules/system/system.module | 1 | ||||
-rw-r--r-- | modules/system/system.test | 18 |
5 files changed, 33 insertions, 50 deletions
diff --git a/modules/block/block.module b/modules/block/block.module index 0361a8b47..cc1e63ba4 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -246,24 +246,21 @@ function block_page_alter($page) { // Load all region content assigned via blocks. foreach (array_keys($all_regions) as $region) { - // Prevent sidebar regions from rendering blocks when 'show_blocks' == FALSE. - if (!empty($page['#show_blocks']) || (strpos($region, 'sidebar_') !== 0)) { - // Assign blocks to region. - if ($blocks = block_get_blocks_by_region($region)) { - $page[$region] = $blocks; - } + // Assign blocks to region. + if ($blocks = block_get_blocks_by_region($region)) { + $page[$region] = $blocks; + } - // Append region description if we are rendering the block admin page. - $item = menu_get_item(); - if ($item['path'] == 'admin/structure/block') { - $visible_regions = system_region_list($theme, REGIONS_VISIBLE); - if (isset($visible_regions[$region])) { - $description = '<div class="block-region">' . $all_regions[$region] . '</div>'; - $page[$region]['block_description'] = array( - '#markup' => $description, - '#weight' => 15, - ); - } + // Append region description if we are rendering the block admin page. + $item = menu_get_item(); + if ($item['path'] == 'admin/structure/block') { + $visible_regions = system_region_list($theme, REGIONS_VISIBLE); + if (isset($visible_regions[$region])) { + $description = '<div class="block-region">' . $all_regions[$region] . '</div>'; + $page[$region]['block_description'] = array( + '#markup' => $description, + '#weight' => 15, + ); } } } diff --git a/modules/block/block.test b/modules/block/block.test index e5217d3f9..414c1d882 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -104,9 +104,21 @@ class BlockTestCase extends DrupalWebTestCase { */ function testBlockVisibility() { $block = array(); - $block['title'] = 'Syndicate'; - $block['module'] = 'node'; - $block['delta'] = 'syndicate'; + + // Create a random title for the block + $title = $this->randomName(8); + + // Create the custom block + $box = array(); + $box['info'] = $this->randomName(8); + $box['title'] = $title; + $box['body'] = $this->randomName(32); + $this->drupalPost('admin/structure/block/add', $box, t('Save block')); + + $bid = db_query("SELECT bid FROM {box} WHERE info = :info", array(':info' => $box['info']))->fetchField(); + $block['module'] = 'block'; + $block['delta'] = $bid; + $block['title'] = $title; // Set the block to be hidden on any user path, and to be shown only to // authenticated users. @@ -119,15 +131,15 @@ class BlockTestCase extends DrupalWebTestCase { $this->moveBlockToRegion($block, $this->regions[1]); $this->drupalGet(''); - $this->assertText('Syndicate', t('Block was displayed on the front page.')); + $this->assertText($title, t('Block was displayed on the front page.')); - $this->drupalGet('user*'); - $this->assertNoText('Syndicate', t('Block was not displayed according to block visibility rules.')); + $this->drupalGet('user'); + $this->assertNoText($title, t('Block was not displayed according to block visibility rules.')); // Confirm that the block is not displayed to anonymous users. $this->drupalLogout(); $this->drupalGet(''); - $this->assertNoText('Syndicate', t('Block was not displayed to anonymous users.')); + $this->assertNoText($title, t('Block was not displayed to anonymous users.')); } /** diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 3b115c872..0f98ef355 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -1308,12 +1308,6 @@ function system_site_information_settings() { '#description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') ); - $form['site_404_blocks'] = array( - '#type' => 'checkbox', - '#title' => t('Display blocks on default 404 (not found) page'), - '#description' => t('Render all blocks on the default 404 (not found) page. Disabling blocks can help with performance but might leave users with a less functional site.'), - '#default_value' => variable_get('site_404_blocks', 0) - ); $form['cron_safe_threshold'] = array( '#type' => 'select', '#title' => t('Automatically run cron'), @@ -1941,7 +1935,6 @@ function system_batch_page() { // display a list of collected messages later. drupal_set_page_content($output); $page = element_info('page'); - $page['#show_blocks'] = FALSE; $page['#show_messages'] = FALSE; return $page; } diff --git a/modules/system/system.module b/modules/system/system.module index e7342e699..502f22b3e 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -291,7 +291,6 @@ function system_elements() { $type['page'] = array( '#show_messages' => TRUE, - '#show_blocks' => TRUE, '#theme' => 'page', ); diff --git a/modules/system/system.test b/modules/system/system.test index b5176fd85..ae77dc0dd 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -626,24 +626,6 @@ class PageNotFoundTestCase extends DrupalWebTestCase { $this->drupalGet($this->randomName(10)); $this->assertText($node->title, t('Found the custom 404 page')); - - // Logout and check that the user login block is not shown on custom 404 pages. - $this->drupalLogout(); - - $this->drupalGet($this->randomName(10)); - $this->assertText($node->title, t('Found the custom 404 page')); - $this->assertNoText(t('User login'), t('Blocks are not shown on the custom 404 page')); - - // Log back in and remove the custom 404 page. - $this->drupalLogin($this->admin_user); - $this->drupalPost('admin/settings/site-information', array('site_404' => ''), t('Save configuration')); - - // Logout and check that the user login block is not shown on default 404 pages. - $this->drupalLogout(); - - $this->drupalGet($this->randomName(10)); - $this->assertText(t('Page not found'), t('Found the default 404 page')); - $this->assertNoText(t('User login'), t('Blocks are not shown on the default 404 page')); } } |