[TwigBridge] button_widget now has its title attr translated even if its label = null or false

This commit is contained in:
Stephen Lewis 2020-01-03 11:56:12 +00:00 committed by Fabien Potencier
parent 8e9aafc84f
commit 2a5d9cb75a

View File

@ -222,13 +222,11 @@
'%name%': name, '%name%': name,
'%id%': id, '%id%': id,
}) %} }) %}
{%- elseif label is same as(false) -%} {%- elseif label is not same as(false) -%}
{% set translation_domain = false %}
{%- else -%}
{% set label = name|humanize %} {% set label = name|humanize %}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</button> <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>
{%- endblock button_widget -%} {%- endblock button_widget -%}
{%- block submit_widget -%} {%- block submit_widget -%}