Skip to content

Commit aaf6915

Browse files
committed
bug #35193 [TwigBridge] button_widget now has its title attr translated even if its label = null or false (stephen-lewis)
This PR was squashed before being merged into the 3.4 branch (closes #35193). Discussion ---------- [TwigBridge] button_widget now has its title attr translated even if its label = null or false | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34330 | License | MIT | Doc PR | TODO Duplicate of #34436 but changed to bugfix and applied to 3.4. Buttons with null or false 'label' options will now have their 'title' attribute translated against the current translation domain. Commits ------- 2a5d9cb [TwigBridge] button_widget now has its title attr translated even if its label = null or false
2 parents c4c0b84 + 2a5d9cb commit aaf6915

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)