Problem/Motivation
There is issue with #field_prefix and #field_suffix of textfield form element. If any textfield which have #field_prefix and #field_suffix property defined in form definition and #field_prefix and #field_prefix have html content then those html will be displayed on screen as plain text. Follow the steps to reproduce:
1. Go to any content type manage field section. (For article content type goto admin/structure/types/manage/article/fields)
2. Add image field if not added, If image field already added then go to image field setting form.
3. See under image field setting form. #field_prefix content <div class="container-inline">
and #field_suffix </div>
are displayed on screen.
Proposed resolution
Edit the form-element.html.twig template and add the raw
twig filter to prefix
and suffix
variable.
Remaining tasks
Write a patch.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | system-field_prefix_suffix_html-2340659-1.patch | 845 bytes | msankhala |
textfield_field_prefix_field_suffix_issue.png | 36.26 KB | msankhala |
Comments
Comment #1
msankhala CreditAttribution: msankhala commentedApplying
raw
filter toprefix
andsuffix
variable resolve the issue. Adding patch.Comment #2
joelpittetRelated and maybe a duplicate (depending of we can solve that).
#2324371: Fix common HTML escaped render #key values due to Twig autoescape
Comment #3
msankhala CreditAttribution: msankhala commentedComment #4
alqahtani CreditAttribution: alqahtani commentedIt's been solved in the linked issue provided by joelpittet on comment #2