[TwigBridge] bootstrap4 file_widget: allow setting label attributes declared in label_attr

This commit is contained in:
Angel Fernando Quiroz Campos 2019-04-23 23:38:29 -05:00 committed by Fabien Potencier
parent 68439059d0
commit 9c76b29d14

View File

@ -122,7 +122,8 @@
<{{ element|default('div') }} class="custom-file">
{%- set type = type|default('file') -%}
{{- block('form_widget_simple') -}}
<label for="{{ form.vars.id }}" class="custom-file-label">
{%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim }) -%}
<label for="{{ form.vars.id }}" {% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
{%- if attr.placeholder is defined -%}
{{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}}
{%- endif -%}