Commit 9d6dcc56 authored by Dries's avatar Dries

- Patch #423992 by JohnAlbin, Davy Van Den Bremt: remove show_blocks page variable.

parent 7c36ac0e
......@@ -424,9 +424,6 @@ function drupal_not_found() {
drupal_set_page_content($return);
$page = element_info('page');
// Optionally omit the blocks to conserve CPU and bandwidth.
$page['#show_blocks'] = variable_get('site_404_blocks', FALSE);
print drupal_render_page($page);
}
......@@ -3893,7 +3890,6 @@ function drupal_set_page_content($content = NULL) {
* A string or array representing the content of a page. The array consists of
* the following keys:
* - #type: Value is always 'page'. This pushes the theming through page.tpl.php (required).
* - #show_blocks: A marker which suppresses sidebar regions if FALSE (optional).
* - #show_messages: Suppress drupal_get_message() items. Used by Batch API (optional).
*
* @see hook_page_alter()
......@@ -4258,7 +4254,7 @@ function drupal_common_theme() {
'template' => 'page',
),
'maintenance_page' => array(
'arguments' => array('content' => NULL, 'show_blocks' => TRUE, 'show_messages' => TRUE),
'arguments' => array('content' => NULL, 'show_messages' => TRUE),
'template' => 'maintenance-page',
'path' => 'includes',
'file' => 'theme.maintenance.inc',
......
......@@ -2022,7 +2022,6 @@ function template_process(&$variables, $hook) {
*/
function template_preprocess_page(&$variables) {
// Move some variables to the top level for themer convenience and template cleanliness.
$variables['show_blocks'] = $variables['page']['#show_blocks'];
$variables['show_messages'] = $variables['page']['#show_messages'];
// Add favicon.
......
......@@ -208,7 +208,6 @@ function theme_update_page($content, $show_messages = TRUE) {
*
* The $variables array contains the following arguments:
* - $content
* - $show_blocks
*
* @see maintenance-page.tpl.php
*/
......
......@@ -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,
);
}
}
}
......
......@@ -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.'));
}
/**
......
......@@ -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;
}
......
......@@ -291,7 +291,6 @@ function system_elements() {
$type['page'] = array(
'#show_messages' => TRUE,
'#show_blocks' => TRUE,
'#theme' => 'page',
);
......
......@@ -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'));
}
}
......
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