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

CommentFileSizeAuthor
helptext.jpg51.99 KBmbrett5062
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mbrett5062’s picture

Issue summary: View changes

Investigated 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())),

mbrett5062’s picture

Issue tags: +Novice
swentel’s picture

Status: Active » Closed (duplicate)
mbrett5062’s picture

Swentel, 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.