When we use checkbox or radio element, we often use in the label.
Term of service, for example.

But label in [template/form/form-element.html.twig] can't render html tag like .
current code
{% if label_display == 'before' %}
<label {{ attributes.addClass(labelclass).setAttribute('for', input_attributes.id) }}>
{{ input_title }}
</label>
{% endif %}
<input{{ input_attributes.addClass(inputclass) }}>
{% if label_display == 'after' %}
<label {{ attributes.addClass(labelclass).setAttribute('for', input_attributes.id) }}>
{{ input_title }}
</label>
{% endif %}
Change the code to
{% if label_display == 'before' %}
<label {{ attributes.addClass(labelclass).setAttribute('for', input_attributes.id) }}>
{{ input_title | raw }}
</label>
{% endif %}
<input{{ input_attributes.addClass(inputclass) }}>
{% if label_display == 'after' %}
<label {{ attributes.addClass(labelclass).setAttribute('for', input_attributes.id) }}>
{{ input_title | raw }}
</label>
{% endif %}
Comments
Comment #2
cobenashComment #3
cobenashComment #5
cobenashComment #6
ldavidsp commentedComment #8
cobenash#6 doesn't work.
striptags will ignore html
<a>tag.The question is {{ input_title }} will display text in plain text without any html tag.
#2 can fix the issue and print with html tag.
Comment #9
cobenashComment #10
npralhad commented#2 works perfectly for me.
Comment #11
hatuhay commented