Issue #2508547 by tim.plunkett, tannerjfco, neclimdul: Placing a block with same machine name of region causes region to disappear in admin UI

8.0.x
xjm 2015-07-05 10:57:05 +01:00
parent 52b3deb617
commit 760cd403bf
2 changed files with 10 additions and 4 deletions

View File

@ -208,20 +208,20 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
'subgroup' => 'block-weight-' . $region,
);
$form['blocks'][$region] = array(
$form['blocks']['region-' . $region] = array(
'#attributes' => array(
'class' => array('region-title', 'region-title-' . $region),
'no_striping' => TRUE,
),
);
$form['blocks'][$region]['title'] = array(
$form['blocks']['region-' . $region]['title'] = array(
'#markup' => $region != BlockInterface::BLOCK_REGION_NONE ? $title : t('Disabled', array(), array('context' => 'Plural')),
'#wrapper_attributes' => array(
'colspan' => 5,
),
);
$form['blocks'][$region . '-message'] = array(
$form['blocks']['region-' . $region . '-message'] = array(
'#attributes' => array(
'class' => array(
'region-message',
@ -230,7 +230,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
),
),
);
$form['blocks'][$region . '-message']['message'] = array(
$form['blocks']['region-' . $region . '-message']['message'] = array(
'#markup' => '<em>' . t('No blocks in this region') . '</em>',
'#wrapper_attributes' => array(
'colspan' => 5,

View File

@ -126,6 +126,12 @@ class BlockUiTest extends WebTestBase {
'The block "' . $label . '" has the correct weight assignment (' . $values['test_weight'] . ').'
);
}
// Add a block with a machine name the same as a region name.
$this->drupalPlaceBlock('system_powered_by_block', ['region' => 'header', 'id' => 'header']);
$this->drupalGet('admin/structure/block');
$element = $this->xpath('//tr[contains(@class, :class)]', [':class' => 'region-title-header']);
$this->assertTrue(!empty($element));
}
/**