diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index 697f09b..944b778 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -343,8 +343,9 @@ public function buildForm(array $form, array &$form_state) { }); foreach ($plugins as $plugin_id => $plugin_definition) { $category = String::checkPlain($plugin_definition['category']); - if (!isset($form['place_blocks']['list'][$category])) { - $form['place_blocks']['list'][$category] = array( + $category_key = 'category-' . $category; + if (!isset($form['place_blocks']['list'][$category_key])) { + $form['place_blocks']['list'][$category_key] = array( '#type' => 'details', '#title' => $category, 'content' => array( @@ -358,7 +359,7 @@ public function buildForm(array $form, array &$form_state) { ), ); } - $form['place_blocks']['list'][$category]['content']['#links'][$plugin_id] = array( + $form['place_blocks']['list'][$category_key]['content']['#links'][$plugin_id] = array( 'title' => $plugin_definition['admin_label'], 'href' => 'admin/structure/block/add/' . $plugin_id . '/' . $this->theme, 'attributes' => array( diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php index 668bd77..6e1899b 100644 --- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php @@ -66,7 +66,7 @@ public function testBlockCategory() { // Test that the block was given a default category corresponding to its // base table. $arguments = array( - ':id' => 'edit-views-test-data', + ':id' => 'edit-category-views-test-data', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1', ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_1/stark'), ':text' => $edit['label'], @@ -85,7 +85,7 @@ public function testBlockCategory() { $link = $this->xpath('//a[@id="views-block-1-block-category" and normalize-space(text())=:label]', array(':label' => $label)); $this->assertTrue(!empty($link)); $this->clickLink($label); - $category = $this->randomString(); + $category = '#' . $this->randomString(); $this->drupalPostForm(NULL, array('block_category' => $category), t('Apply')); // Clone the block after changing the category. @@ -95,14 +95,14 @@ public function testBlockCategory() { $this->drupalPostForm(NULL, array(), t('Save')); // Test that the blocks are listed under the correct categories. - $category_id = drupal_html_id('edit-' . String::checkPlain($category)); + $category_id = drupal_html_id('edit-category-' . String::checkPlain($category)); $arguments[':id'] = $category_id; $this->drupalGet('admin/structure/block'); $elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments); $this->assertTrue(!empty($elements), 'The test block appears in the custom category.'); $arguments = array( - ':id' => 'edit-views-test-data', + ':id' => 'edit-category-views-test-data', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2', ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_2/stark'), ':text' => $edit['label'],