Skip to content
Snippets Groups Projects
Commit fdef5cf7 authored by catch's avatar catch
Browse files

Issue #1103590 by Tor Arne Thune, dcrocks, xjm: Fixed blocks being added to...

Issue #1103590 by Tor Arne Thune, dcrocks, xjm: Fixed blocks being added to 'hidden' region when theme 1st enabled.
parent c2c7f345
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -755,3 +755,39 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
$this->assertEqual($variables2['content_attributes_array']['class'], array('test-class', 'content'), t('Default .content class added to block content_attributes_array'));
}
}
/**
* Tests that hidden regions do not inherit blocks when a theme is enabled.
*/
class BlockHiddenRegionTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Blocks not in hidden region',
'description' => 'Checks that a newly enabled theme does not inherit blocks to its hidden regions.',
'group' => 'Block',
);
}
/**
* Tests that hidden regions do not inherit blocks when a theme is enabled.
*/
function testBlockNotInHiddenRegion() {
// Create administrative user.
$admin_user = $this->drupalCreateUser(array('administer blocks', 'administer themes', 'search content'));
$this->drupalLogin($admin_user);
// Enable "block_test_theme" and set it as the default theme.
$theme = 'block_test_theme';
theme_enable(array($theme));
variable_set('theme_default', $theme);
menu_rebuild();
// Ensure that "block_test_theme" is set as the default theme.
$this->drupalGet('admin/structure/block');
$this->assertText('Block test theme(' . t('active tab') . ')', t('Default local task on blocks admin page is the block test theme.'));
// Ensure that the search form block is displayed.
$this->drupalGet('');
$this->assertText('Search', t('Block was displayed on the front page.'));
}
}
name = Block test theme
description = Theme for testing the block system
core = 8.x
hidden = TRUE
regions[sidebar_first] = Left sidebar
regions_hidden[] = sidebar_first
regions[sidebar_second] = Right sidebar
regions_hidden[] = sidebar_second
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[highlighted] = Highlighted
regions[help] = Help
<?php
/**
* @file
* Custom theme implementation to display a single Drupal page without
* sidebars. The sidebars are hidden by regions_hidden for this theme, so
* the default page.tpl.php will not work without throwing exceptions.
*/
?>
<div id="page-wrapper"><div id="page">
<div id="header"><div class="section clearfix">
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>
<?php endif; ?>
<?php if ($site_name || $site_slogan): ?>
<div id="name-and-slogan">
<?php if ($site_name): ?>
<?php if ($title): ?>
<div id="site-name"><strong>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</strong></div>
<?php else: /* Use h1 when the content title is empty */ ?>
<h1 id="site-name">
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</h1>
<?php endif; ?>
<?php endif; ?>
<?php if ($site_slogan): ?>
<div id="site-slogan"><?php print $site_slogan; ?></div>
<?php endif; ?>
</div> <!-- /#name-and-slogan -->
<?php endif; ?>
<?php print render($page['header']); ?>
</div></div> <!-- /.section, /#header -->
<?php if ($main_menu || $secondary_menu): ?>
<div id="navigation"><div class="section">
<?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
<?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Secondary menu'))); ?>
</div></div> <!-- /.section, /#navigation -->
<?php endif; ?>
<?php if ($breadcrumb): ?>
<div id="breadcrumb"><?php print $breadcrumb; ?></div>
<?php endif; ?>
<?php print $messages; ?>
<div id="main-wrapper"><div id="main" class="clearfix">
<div id="content" class="column"><div class="section">
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
<?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs = render($tabs)): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
<?php print render($page['content']); ?>
<?php print $feed_icons; ?>
</div></div> <!-- /.section, /#content -->
</div></div> <!-- /#main, /#main-wrapper -->
<div id="footer"><div class="section">
<?php print render($page['footer']); ?>
</div></div> <!-- /.section, /#footer -->
</div></div> <!-- /#page, /#page-wrapper -->
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment