From 154d593e5dccbd80d3b37f72387bb723fbb868df Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 9 Mar 2010 03:48:59 +0000 Subject: - Patch #503782 by skilip, Davy Van Den Bremt, eojthebrave, sign: not able to select region at block creation. --- modules/block/block.admin.inc | 2 +- modules/block/block.module | 2 +- modules/block/block.test | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 3497a7a28..75c215de9 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -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('')) + system_region_list($key, REGIONS_VISIBLE), '#expandable' => ($key !== $theme_default), '#weight' => ($key == $theme_default ? 9 : 10), ); diff --git a/modules/block/block.module b/modules/block/block.module index 183148ec6..ad56834e9 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -31,7 +31,7 @@ function block_help($path, $arg) { $output .= ''; return $output; case 'admin/structure/block/add': - return '

' . 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 Blocks administration page, to make them visible.', array('@blocks' => url('admin/structure/block'))) . '

'; + return '

' . t('Use this page to create a new custom block.') . '

'; } 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'); diff --git a/modules/block/block.test b/modules/block/block.test index e80de7c31..a2788d4e4 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -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); -- cgit v1.2.3