Problem/Motivation

See #2566503: [meta] Replace remaining !placeholder for Non-URL HTML outputs only

ConfigSync is using !placeholder.

Proposed resolution

  • !change is the result of a render and therefore will not be escaped by the @placeholder
  • !collection is a configuration collection. This is defined in code and results in directories being created on the file system - can not contain HTML. Therefore safe to change to @placeholder

Remaining tasks

Review
Commit

User interface changes

None

API changes

None

Data model changes

None

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.45 KB
alexpott’s picture

StatusFileSize
new4.04 KB

Actually we should use an inline template here. Unfortunately this does not work because it is too long :( we need to fix #2558885: TwigEnvironment is unable to cache inline templates because it sends invalid filenames to MTimeProtectedFastFileStorage

alexpott’s picture

StatusFileSize
new1.14 KB
new3.93 KB

There is always another way :)

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Nice workaround! :P Tested this manually on the config sync page and everything seems to work like before so RTBC if passes.

The last submitted patch, 3: 2569419-2-3.patch, failed testing.

dawehner’s picture

Looks perfect, indeed

The last submitted patch, 3: 2569419-2-3.patch, failed testing.

alexpott’s picture

Priority: Major » Critical

This is part of the critical meta.

xjm’s picture

Status: Reviewed & tested by the community » Fixed

A good improvement, and consistent with other places we're adding item lists to status messages.

+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -205,7 +206,8 @@ public function testExportImport() {
-    $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.');
+    $this->assertRaw('<li>system.site</li>');

I asked myself whether this was sufficiently specific to ensure that it does not match system.site somewhere else on the page now and in the future (probably). At first I thought it might be inappropriately reliant on the markup or risk a false positive if we change the config UI in the future, but OTOH, it is good to test that the <li> tags do not get escaped.

Something like an xpath or cssSelect() would be more robust, but this should be sufficient. I would however add an inline comment explaining why we're testing for the <li> tag specifically so that someone doesn't "clean it up" in the future and regress the coverage.

So I did that on commit:

diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index be14c46..4118387 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -188,6 +188,8 @@ public function testExportImport() {
     $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.');
+    // 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.
@@ -207,6 +209,8 @@ public function testExportImport() {
     $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.');
+    // 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>');
   }

Committed and pushed to 8.0.x.

  • xjm committed 1a4fb65 on 8.0.x
    Issue #2569419 by alexpott, lauriii, xjm: Replace remaining !placeholder...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.