diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php index 19c12463f49aa025cd056362ca2384821a73aafd..e9b14cb4e87a353aa4bb7d2a861e0c24fc54d039 100644 --- a/core/modules/config/src/Form/ConfigSync.php +++ b/core/modules/config/src/Form/ConfigSync.php @@ -217,12 +217,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { } } sort($change_list); - $change_list_render = array( - '#theme' => 'item_list', - '#items' => $change_list, - ); - $change_list_html = $this->renderer->renderPlain($change_list_render); - drupal_set_message($this->t('The following items in your active configuration have changes since the last import that may be lost on the next import. !changes', array('!changes' => $change_list_html)), 'warning'); + $message = [ + [ + '#markup' => $this->t('The following items in your active configuration have changes since the last import that may be lost on the next import.') + ], + [ + '#theme' => 'item_list', + '#items' => $change_list, + ] + ]; + drupal_set_message($this->renderer->renderPlain($message), 'warning'); } } @@ -237,7 +241,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form[$collection]['collection_heading'] = array( '#type' => 'html_tag', '#tag' => 'h2', - '#value' => $this->t('!collection configuration collection', array('!collection' => $collection)), + '#value' => $this->t('@collection configuration collection', array('@collection' => $collection)), ); } foreach ($storage_comparer->getChangelist(NULL, $collection) as $config_change_type => $config_names) { diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php index e913e0d1d9c357dd8e449c2b5cb3aaa90018b131..41183877ff1e9177584bd87b303d82f5a543cbcb 100644 --- a/core/modules/config/src/Tests/ConfigExportImportUITest.php +++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php @@ -187,13 +187,16 @@ public function testExportImport() { ->save(); $this->drupalGet('admin/config/development/configuration'); $this->assertText(t('Warning message')); - $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site'); + $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); + // Ensure the item is displayed as part of a list (to avoid false matches + // on the rest of the page) and that the list markup is not escaped. + $this->assertRaw('<li>system.site</li>'); // Remove everything from staging. The warning about differences between the // active and snapshot should no longer exist. \Drupal::service('config.storage.staging')->deleteAll(); $this->drupalGet('admin/config/development/configuration'); $this->assertNoText(t('Warning message')); - $this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site'); + $this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); $this->assertText(t('There are no configuration changes to import.')); // Write a file to staging. The warning about differences between the // active and snapshot should now exist. @@ -205,7 +208,10 @@ public function testExportImport() { $staging->write('system.site', $data); $this->drupalGet('admin/config/development/configuration'); $this->assertText(t('Warning message')); - $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import. system.site'); + $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); + // Ensure the item is displayed as part of a list (to avoid false matches + // on the rest of the page) and that the list markup is not escaped. + $this->assertRaw('<li>system.site</li>'); } /**