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

Skip to content

Commit 2a5d9cb

Browse files
stephen-lewisfabpot
authored andcommitted
[TwigBridge] button_widget now has its title attr translated even if its label = null or false
1 parent 8e9aafc commit 2a5d9cb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,11 @@
222222
'%name%': name,
223223
'%id%': id,
224224
}) %}
225-
{%- elseif label is same as(false) -%}
226-
{% set translation_domain = false %}
227-
{%- else -%}
225+
{%- elseif label is not same as(false) -%}
228226
{% set label = name|humanize %}
229227
{%- endif -%}
230228
{%- endif -%}
231-
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</button>
229+
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) or label is same as(false) ? label : label|trans({}, translation_domain) }}</button>
232230
{%- endblock button_widget -%}
233231

234232
{%- block submit_widget -%}

0 commit comments

Comments
 (0)