Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I am starting a new form theme on top of The issue with Web Awseome is that, in most input, the input label is not set as an HTML element, but rather as a slot of the custom input element. Here is a sample code for an input with a label:
I think I can read the value of the label for the input field, but I do not know how to avoid the display of an HTML How can I avoid the production of the TIA |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
It comes from the {%extends'form_div_layout.html.twig' %}{%blockform_widget %} {%iflabel_htmlissame as(false) %} {%setattr=attr|merge({label:block('form_label_content') }) %} {%endif %} {{parent() }}{%endblockform_widget %}{%blockform_label %} {%iflabel_htmlissame as(true) %} {%setlabel_attr=label_attr|merge({slot:'label'}) %} {{parent() }} {%endif %}{%endblockform_label %} Wouldn’t it be simpler to always use the |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks a lot.I will continue watching the Symfony Casts lessons on form theming to go deeper into the subject.All the best,François …--Sent from Canary (https://canarymail.io) On lundi, juil. 14, 2025 at 9:58 PM, Mathieu ***@***.*** ***@***.***)> wrote: > > I do not know how to avoid the display of an HTML label element > It comes from the form_label block so you have to override it. Note that labels can contain HTML so you’d need to check the label_html option, e.g. {% extends 'form_div_layout.html.twig' %} {% block form_widget %} {% if label_html is same as(false) %} {% set attr = attr|merge({label: block('form_label_content') }) %} {% endif %} {{ parent() }} {% endblock form_widget %} {% block form_label %} {% if label_html is same as(true) %} {% set label_attr = label_attr|merge({slot: 'label'}) %} {{ parent() }} {% endif %} {% endblock form_label %} — Reply to this email directly, view it on GitHub (#61102 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AA5AL2YXYR5KO2JHXRMVQCL3IQDUTAVCNFSM6AAAAACBJIP7XKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZVGY2TMNY). You are receiving this because you authored the thread.Message ID: ***@***.***> |
BetaWas this translation helpful?Give feedback.