Skip to content

Commit

Permalink
bug #35193 [TwigBridge] button_widget now has its title attr translat…
Browse files Browse the repository at this point in the history
…ed 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
  • Loading branch information
fabpot committed Jan 7, 2020
2 parents c4c0b84 + 2a5d9cb commit aaf6915
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -222,13 +222,11 @@
'%name%': name,
'%id%': id,
}) %}
{%- elseif label is same as(false) -%}
{% set translation_domain = false %}
{%- else -%}
{%- elseif label is not same as(false) -%}
{% set label = name|humanize %}
{%- 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 -%}

{%- block submit_widget -%}
Expand Down

0 comments on commit aaf6915

Please sign in to comment.