diff --git a/core/modules/block/lib/Drupal/block/BlockListBuilder.php b/core/modules/block/lib/Drupal/block/BlockListBuilder.php index 113e8be3cbf..e55d6e85208 100644 --- a/core/modules/block/lib/Drupal/block/BlockListBuilder.php +++ b/core/modules/block/lib/Drupal/block/BlockListBuilder.php @@ -408,6 +408,10 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface $entity->save(); } drupal_set_message(t('The block settings have been updated.')); + + // Remove any previously set block placement. + $this->request->query->remove('block-placement'); + Cache::invalidateTags(array('content' => TRUE)); } diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php index bbcc0614de6..d842401a163 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php @@ -176,4 +176,23 @@ class BlockUiTest extends WebTestBase { $this->assertFieldByName('id', 'displaymessage_3', 'Block form appends _3 to plugin-suggested machine name when two instances already exist.'); } + /** + * Tests the block placement indicator. + */ + public function testBlockPlacementIndicator() { + // Select the 'Powered by Drupal' block to be placed. + $block = array(); + $block['id'] = strtolower($this->randomName()); + $block['theme'] = 'stark'; + $block['region'] = 'content'; + + // After adding a block, it will indicate which block was just added. + $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block')); + $this->assertUrl('admin/structure/block/list/stark?block-placement=' . drupal_html_class($block['id'])); + + // Resaving the block page will remove the block indicator. + $this->drupalPostForm(NULL, array(), t('Save blocks')); + $this->assertUrl('admin/structure/block/list/stark'); + } + }