Summary:

I noticed this while reviewing other similar issue.
https://www.drupal.org/node/2200731

In Views, while adding/editing fields/filters/sort's in modal window Characters like apostroph's get double encoded, so you end up with bug's instead of bug's:

Before screenshot

double encoded admin-title

Steps to reproduce:

  • Install D8.0.0-beta15
  • go to a view, eg. /admin/structure/views/view/content
  • edit a field's (or filter-/sort-criteria's) administrative title to something with special chars, eg bug's
  • click on field name in views UI
  • see the result bug's (source is bug's

After screenshot

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikgreen created an issue. See original summary.

mikgreen’s picture

Issue summary: View changes
mikgreen’s picture

FileSize
787 bytes

This is due to part of title being translated twice.

One solution is to output title label and title content sepratelly.

See patch.

dawehner’s picture

Issue tags: +Needs tests

.

mikgreen’s picture

What should the tests test?

dawehner’s picture

Well, ensure that its not double escaped.

jaxxed’s picture

@mikgreen testing idea:

1. add field to content type that has an "apastraphe" in it ( :P )
2. check field edit link for label with #039; in it (assert that it doesn't have it)

dawehner’s picture

Title: Field title is translated twice in Views field edit modal frame » Field title is escaped twice in Views field edit modal frame

.

albertski’s picture

Might be just a personal preference but perhaps it would be better to use !variable instead of concatenating.

GaëlG’s picture

Status: Needs review » Reviewed & tested by the community

Last patch works.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
@@ -154,7 +154,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Request $
+        $form['#title'] = $this->t('Configure @type: !item', array('@type' => $types[$type]['lstitle'], '!item' => $handler->adminLabel()));

This is adding a !placeholder as we are removing them.

And still needs tests.

maris.abols’s picture

Assigned: Unassigned » maris.abols
maris.abols’s picture

Patch #9 not working as it returns title like this "Configure field: [em class="placeholder"]Content: Title's with apastrophy[/em]".

mikgreen’s picture

Title: Field title is escaped twice in Views field edit modal frame » Field title is rendering special scaracters as html entites in Views field edit modal frame
Assigned: maris.abols » Unassigned
Status: Needs work » Active

This issues has been changing as changes were made to how these strings are translated.

Currently special chars in field title are correctly converted to html entities. Then field title is set as a form title. Which is rendered as is.

Wny aren't html entities in form titles rendered as special chars?

mikgreen’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
10.26 KB

Here's a new solution.
Inspired by https://www.drupal.org/node/2200731#comment-10377713

We are decoding entities before displaying them in the Ajax\OpenDialogCommand class.

Also added a test. This is a first test I wrote, so please be patient.

Status: Needs review » Needs work

The last submitted patch, 16: ajax-title-patch-test.diff, failed testing.

The last submitted patch, 16: ajax-title-patch-test.diff, failed testing.

maris.abols’s picture

Assigned: Unassigned » maris.abols
maris.abols’s picture

Assigned: maris.abols » Unassigned
maijs’s picture

Title: Field title is rendering special scaracters as html entites in Views field edit modal frame » Field title is rendering special characters as html entites in Views field edit modal frame
mikgreen’s picture

jaxxed’s picture

jaxxed’s picture

Status: Needs review » Reviewed & tested by the community

patch works: I tested several views ui components for apostrophes, without any issues. views_ui tests ran without any problems.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This fix still does not feel correct - why is the title not already an object which implements MarkupInterface?

+++ b/core/modules/views_ui/tests/modules/views_field_test_config/views_field_test_config.info.yml
@@ -0,0 +1,11 @@
+  - views_ui
\ No newline at end of file

Missing new line.

pradeep22saini’s picture

As per Alexpott comment added new line.

pradeep22saini’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 26: 2568149-25.patch, failed testing.

marvin_B8’s picture

@alexpott yes its a better solution to use a object which implements MarkupInterface. But for 8.0.x we need this simple patch. The object way is nice but a bc.

I think we should implement the simple patch now and fix it in drupal 8.1.x with the nice way.

marvin_B8’s picture

Status: Needs work » Needs review

The last submitted patch, 26: 2568149-25.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jeffrey.vargas’s picture

I am reviewing this at DrupalCon NOLA 2016.

Testing this against 8.1.x

jeffrey.vargas’s picture

Reviewed the existing 8.1.1 release and followed the instructions to reproduce the bug above:

Escaped Apostrophe in administrative title

I reviewed patch 2568149-29 and applied it to my local 8.1.1 D8 install and then reviewed the view's name with an apostrophe in the administrative title and found that it was no longer getting double-encoded and is displayed properly:

Administrative title with patch applied

This issue is reviewed and RTBC.

jeffrey.vargas’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I'm still not sure that this is the correct approach. We need to test what would happen if people put html entities like in a field name here.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Ismael.liberal’s picture

Status: Needs work » Needs review
FileSize
43.94 KB

Here screenshot

issue screenshot

keopx’s picture

Status: Needs review » Reviewed & tested by the community

Screenshot added and I think we can change to RTBC

xjm’s picture

Status: Reviewed & tested by the community » Needs review

#36 is still not addressed.

Berdir’s picture

Status: Needs review » Postponed (maintainer needs more info)

Pretty sure that #2207247: Dialog titles double escaped for views handlers and delete forms fixed this, can someone re-test with latest 8.2.x?

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

g-brodiei’s picture

tested on 8.1.1 to regenerate issue

8.1.1 bug display

re-tested on 8.2.8-dev, I believe the issue is fixed as mentioned by @Berdir

8.2.x bug resolved

I think we can close this issue?

jungle’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Not an issue anymore in 8.9.x as well, so let's close it. Thanks, everyone for your efforts!