Problem/Motivation
Help text on 'Body' field is displaying HTML characters and unicode characters also.
This can be seen when you go to:
admin/structure/types/manage/page/fields/node.page.body
The markup is found at line #130 in:
core\modules\field_ui\src\Form\FieldEditForm.php
Here is the line in question:
'#description' => $this->t('Instructions to present to the user below this field on the editing form.<br />Allowed HTML tags: @tags', array('@tags' => $this->displayAllowedTags())) . '<br />' . $this->t('This field supports tokens.'),
I believe the issue maybe that the 't' was not closed after "... on the editing form." But I don't know enough to be sure.
Proposed resolution
Change the line to read this:
'#description' => $this->t('Instructions to present to the user below this field on the editing form.<br />Allowed HTML tags: @tags<br />This field supports tokens.', array('@tags' => $this->displayAllowedTags())),
Remaining tasks
User interface changes
This corrects the UI.
API changes
Comment | File | Size | Author |
---|---|---|---|
helptext.jpg | 51.99 KB | mbrett5062 |
Comments
Comment #1
mbrett5062 CreditAttribution: mbrett5062 commentedInvestigated further and following is the line as it should be. Tested this locally and works, however I do not have a correct environment for creating a patch so will leave that to someone else. Also marking as novice.
'#description' => $this->t('Instructions to present to the user below this field on the editing form.<br />Allowed HTML tags: @tags<br />This field supports tokens.', array('@tags' => $this->displayAllowedTags())),
Comment #2
mbrett5062 CreditAttribution: mbrett5062 commentedComment #3
swentel CreditAttribution: swentel commentedWill be fixed by #2324371: Fix common HTML escaped render #key values due to Twig autoescape
Comment #4
mbrett5062 CreditAttribution: mbrett5062 commentedSwentel, while that issue may fix the issue I see, so does my change. Plus the change I made is more in keeping with Drupal standards with regard to breaking up strings that are intended for translation.
The current text is broken to insert the definition array for @tags, and also has the second HTML
<br />
tag broken out.My change works, and is much cleaner for translators to read, as per Drupal guidelines.
Plus I have just tested with the patch applied and both the old and new code work.
I have also spotted what I think is an error in the code on that "fixed" issue. Will post a comment there now.
Meantime, could you re-open this as a "minor" issue to bring the code inline with Drupal coding standards as far as translatable text applies.