Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c838f9

Browse files
committed
feature #26408 Readd 'form_label_errors' block to disable errors on form labels (birkof)
This PR was merged into the 3.4 branch. Discussion ---------- Readd 'form_label_errors' block to disable errors on form labels | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | License | MIT Re-added **form_label_errors** block on bootstrap 4 form themes. You can disable errors shown on form labels by simply extend bootstrap4 layout and empty **form_label_errors** block. See below: ``` {% use "bootstrap_4_layout.html.twig" %} {# Disable errors shown on form labels #} {% block form_label_errors %}{% endblock form_label_errors %} ``` Block previously removed [here](b375957#diff-62cb2a10f5a37db0e87e3bd81609b17dR186) by @nicolas-grekas. cc @Nyholm Commits ------- 5b4354f Readd 'form_label_errors' block to disable errors on form labels
2 parents c59bbc5 + 5b4354f commit 2c838f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
{% set label = name|humanize %}
204204
{%- endif -%}
205205
{%- endif -%}
206-
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{{- form_errors(form) -}}</{{ element|default('label') }}>
206+
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{% block form_label_errors %}{{- form_errors(form) -}}{% endblock form_label_errors %}</{{ element|default('label') }}>
207207
{%- else -%}
208208
{%- if errors|length > 0 -%}
209209
<div id="{{ id }}_errors" class="mb-2">

0 commit comments

Comments
 (0)