Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
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 isbug's
After screenshot
Comment | File | Size | Author |
---|---|---|---|
#48 | bugs_apostrophe_8.2.x.png | 43.08 KB | g-brodiei |
#48 | bugs_apostrophe_8.1.1.png | 37.26 KB | g-brodiei |
#38 | 2568149_html.png | 43.94 KB | Ismael.liberal |
#34 | Screen Shot 2016-05-13 at 3.29.35 PM.png | 76.76 KB | jeffrey.vargas |
#34 | Screen Shot 2016-05-13 at 3.32.53 PM.png | 84.12 KB | jeffrey.vargas |
Comments
Comment #2
mikgreen CreditAttribution: mikgreen at Wunder commentedComment #3
mikgreen CreditAttribution: mikgreen at Wunder commentedThis is due to part of title being translated twice.
One solution is to output title label and title content sepratelly.
See patch.
Comment #4
dawehner.
Comment #5
mikgreen CreditAttribution: mikgreen at Wunder commentedWhat should the tests test?
Comment #6
dawehnerWell, ensure that its not double escaped.
Comment #7
jaxxed CreditAttribution: jaxxed at Wunder commented@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)
Comment #8
dawehner.
Comment #9
albertski CreditAttribution: albertski as a volunteer commentedMight be just a personal preference but perhaps it would be better to use !variable instead of concatenating.
Comment #10
GaëlGLast patch works.
Comment #11
alexpottThis is adding a
!placeholder
as we are removing them.And still needs tests.
Comment #13
maris.abols CreditAttribution: maris.abols commentedComment #14
maris.abols CreditAttribution: maris.abols commentedPatch #9 not working as it returns title like this "Configure field: [em class="placeholder"]Content: Title's with apastrophy[/em]".
Comment #15
mikgreen CreditAttribution: mikgreen at Wunder commentedThis 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?
Comment #16
mikgreen CreditAttribution: mikgreen at Wunder commentedHere'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.
Comment #19
maris.abols CreditAttribution: maris.abols commentedComment #20
maris.abols CreditAttribution: maris.abols commentedComment #21
maijs CreditAttribution: maijs at Wunder commentedComment #22
mikgreen CreditAttribution: mikgreen at Wunder commentedAnother try at the test.
Comment #23
jaxxed CreditAttribution: jaxxed at Wunder commentedComment #24
jaxxed CreditAttribution: jaxxed at Wunder commentedpatch works: I tested several views ui components for apostrophes, without any issues. views_ui tests ran without any problems.
Comment #25
alexpottThis fix still does not feel correct - why is the title not already an object which implements MarkupInterface?
Missing new line.
Comment #26
pradeep22saini CreditAttribution: pradeep22saini commentedAs per Alexpott comment added new line.
Comment #27
pradeep22saini CreditAttribution: pradeep22saini commentedComment #29
marvin_B8 CreditAttribution: marvin_B8 as a volunteer and at comm-press commented@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.
Comment #30
marvin_B8 CreditAttribution: marvin_B8 as a volunteer and at comm-press commentedComment #33
jeffrey.vargas CreditAttribution: jeffrey.vargas as a volunteer commentedI am reviewing this at DrupalCon NOLA 2016.
Testing this against 8.1.x
Comment #34
jeffrey.vargas CreditAttribution: jeffrey.vargas as a volunteer commentedReviewed the existing 8.1.1 release and followed the instructions to reproduce the bug above:
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:
This issue is reviewed and RTBC.
Comment #35
jeffrey.vargas CreditAttribution: jeffrey.vargas as a volunteer commentedComment #36
alexpottI'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.
Comment #38
Ismael.liberal CreditAttribution: Ismael.liberal at Biko2 commentedHere screenshot
Comment #39
keopxScreenshot added and I think we can change to RTBC
Comment #40
xjm#36 is still not addressed.
Comment #41
BerdirPretty sure that #2207247: Dialog titles double escaped for views handlers and delete forms fixed this, can someone re-test with latest 8.2.x?
Comment #48
g-brodieitested on 8.1.1 to regenerate issue
re-tested on 8.2.8-dev, I believe the issue is fixed as mentioned by @Berdir
I think we can close this issue?
Comment #49
jungleNot an issue anymore in 8.9.x as well, so let's close it. Thanks, everyone for your efforts!