Commit 760cd403 authored by xjm's avatar xjm

Issue #2508547 by tim.plunkett, tannerjfco, neclimdul: Placing a block with...

Issue #2508547 by tim.plunkett, tannerjfco, neclimdul: Placing a block with same machine name of region causes region to disappear in admin UI
parent 52b3deb6
......@@ -208,20 +208,20 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'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 @@ public function buildForm(array $form, FormStateInterface $form_state) {
),
),
);
$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,
......
......@@ -126,6 +126,12 @@ function testBlockAdminUiPage() {
'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));
}
/**
......
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