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.
Problem/Motivation
The title of page with HTML tags shows HTML tags in shortcut label in the shortcut toolbar tray.
Proposed resolution
Strip the html from the page title.
Remaining tasks
RTBC
Before
After
User interface changes
Fix the display message and label in the shortcut toolbar tray.
API changes
None
Data model changes
None
Original report by @malavya
When a title have HTML tags in it and the title is added in the shortcut menu, the shortcut label also prints out the HTML tags.
Comment | File | Size | Author |
---|---|---|---|
#33 | page_title_with_html-2672668-33.patch | 5.45 KB | jibran |
#9 | strip_html_tags_from-2672668-9-pass.patch | 2.2 KB | jibran |
#9 | strip_html_tags_from-2672668-9-fail.patch | 1.57 KB | jibran |
Comments
Comment #2
imalabyaComment #3
imalabyaAdded a patch for this issue.
Comment #4
imalabyaComment #5
imalabyaComment #6
imalabyaComment #7
Dinesh18 CreditAttribution: Dinesh18 as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedI have tested the patch, but it is not giving the desired output.
Comment #8
jibranThis is not a correct fix and we need some tests here.
Comment #9
jibranHere we go. Red and green patch.
Before
After
Comment #10
jibranWe need to fix that in 8.0.x as well.
Comment #11
jibranComment #14
archunan CreditAttribution: archunan commentedHi Team,
I feel this is invalid request and its working as the way node title works.Since we have default styling for links on core, need to have any tag over the links/title
Node screen [d8nodescreen.png]
Let me your thought.
Comment #15
imalabyaHi @archunan, I think you got the issue wrong.
In the example you have given
<h2>About us</h2>
is not a text wrapped inside HTMLtag but it is treated whole as a text. You can check that in the source.
The issue is if the page title have some HTML elements that should not be reflecting in the shortcut label when the shortcut is created.
Comment #16
imalabyaPing
Comment #18
msankhala CreditAttribution: msankhala commentedI tested patch provided in #9 strip_html_tags_from-2672668-9-pass.patch This patch is fixing this issue. I followed below steps in fresh
drupal 8.2.0-dev
installation./admin/structure/menu/manage/main
where title is dynamic.drush cr
Comment #19
jibranSo RTBC then?
Comment #20
msankhala CreditAttribution: msankhala commentedYes, Moving this to RTBC, I can confirm that this patch fix this issue. Feel free to move back in "Need Review" if someone still find any issue with this.
Comment #22
jibranThis is a bug report so it should be filed against 8.1.x. Test fails seem unrelated so retesting and setting it back to RTBC.
Comment #24
jibranComment #25
jibran#24 is just a reroll so back to RTBC.
Comment #26
Wim LeersNit: s/the html/HTML/
This should not be necessary?
Nit: s/html/HTML/
IMO clearer:
Nit: extraneous newline.
Comment #27
jibranFixed #26.
Comment #28
Wim LeersMuch better!
Comment #29
willzyx CreditAttribution: willzyx commentedLooks like very similar to #2478907: Shortcuts names for node view routes are not properly sanitized (using quick link). If you want prefer this issue and mark #2478907: Shortcuts names for node view routes are not properly sanitized (using quick link) as duplicated can we add the test coverage produced in that issue?
Comment #31
jibranRandom fail.
Comment #32
catchiCNW for #29 - please also mark the other issue duplicate and we'll transfer commit credits from their prior to commit.
Comment #33
jibranHere we go.
Comment #35
tstoecklerYup, looks good to me.
Comment #36
tstoecklerComment #38
alexpottAdding credit from the other issue.
Comment #39
alexpottCommitted and pushed d963647 to 8.3.x and 3c355f8 to 8.2.x. Thanks!