- Patch #503782 by skilip, Davy Van Den Bremt, eojthebrave, sign: not able to select region at block creation.

merge-requests/26/head
Dries Buytaert 2010-03-09 03:48:59 +00:00
parent 972d2fed4d
commit 154d593e5d
3 changed files with 16 additions and 2 deletions

View File

@ -239,7 +239,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) {
'#type' => 'select',
'#title' => $theme->info['name'],
'#default_value' => (!empty($region) ? $region : BLOCK_REGION_NONE),
'#options' => array(BLOCK_REGION_NONE => t('Disabled')) + $theme->info['regions'],
'#options' => array(BLOCK_REGION_NONE => t('<none>')) + system_region_list($key, REGIONS_VISIBLE),
'#expandable' => ($key !== $theme_default),
'#weight' => ($key == $theme_default ? 9 : 10),
);

View File

@ -31,7 +31,7 @@ function block_help($path, $arg) {
$output .= '</dl>';
return $output;
case 'admin/structure/block/add':
return '<p>' . t('Use this page to create a new custom block. New blocks are disabled by default; assign them to a region, on this page or the <a href="@blocks">Blocks administration page</a>, to make them visible.', array('@blocks' => url('admin/structure/block'))) . '</p>';
return '<p>' . t('Use this page to create a new custom block.') . '</p>';
}
if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) {
$demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'garland');

View File

@ -44,6 +44,20 @@ class BlockTestCase extends DrupalWebTestCase {
* Test creating custom block, moving it to a specific region and then deleting it.
*/
function testCustomBlock() {
// Confirm that hidden regions are not shown as options for block placement
// when adding a new block.
theme_enable(array('stark'));
$themes = list_themes();
$this->drupalGet('admin/structure/block/add');
foreach ($themes as $key => $theme) {
if ($theme->status) {
foreach ($theme->info['regions_hidden'] as $hidden_region) {
$elements = $this->xpath('//select[@id="edit-regions-' . $key . '"]//option[@value="' . $hidden_region . '"]');
$this->assertFalse(isset($elements[0]), t('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
}
}
}
// Add a new custom block by filling out the input form on the admin/structure/block/add page.
$custom_block = array();
$custom_block['info'] = $this->randomName(8);