Skip to content

Commit 4002f26

Browse files
committed
Merge branch '4.1'
* 4.1: fixed typo [FrameworkBundle] fixed brackets position in method calls Add placeholder support in bootstrap 4 file fields [Form] Improve rendering of `file` field in bootstrap 4 [Form] Fix PHPDoc for FormConfigBuilder $dataClass argument [Security] Update user phpdoc on tokens [WebProfilerBundle] Fixed icon alignment issue using Bootstrap 4.1.2 suppress side effects in 'get' or 'has' methods of NamespacedAttributeBag [HttpFoundation] reset callback on StreamedResponse when setNotModified() is called [HttpFoundation] Fixed phpdoc for get method of HeaderBag fix typo in ContainerBuilder docblock [Form/Profiler] Massively reducing memory footprint of form profiling pages by removing redundant 'form' variable from view variables. [Console] correctly return parameter's default value on "--" [DependencyInjection] add missing test for #27710 [EventDispatcher] Clear orphaned events on TraceableEventDispatcher::reset Fix serialization of abstract items with groups across multiple entities
2 parents fded3bb + f45db1f commit 4002f26

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@
114114
</div>
115115
{%- endblock percent_widget %}
116116

117+
{% block file_widget -%}
118+
<div class="form-group">
119+
<{{ element|default('div') }} class="custom-file">
120+
{%- set type = type|default('file') -%}
121+
{{- block('form_widget_simple') -}}
122+
<label for="{{ form.vars.id }}" class="custom-file-label">
123+
{%- if attr.placeholder is defined -%}
124+
{{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}}
125+
{%- endif -%}
126+
</label>
127+
</{{ element|default('div') }}>
128+
</div>
129+
{% endblock %}
130+
117131
{% block form_widget_simple -%}
118132
{% if type is not defined or type != 'hidden' %}
119133
{%- set attr = attr|merge({class: (attr.class|default('') ~ (type|default('') == 'file' ? ' custom-file-input' : ' form-control'))|trim}) -%}
@@ -186,8 +200,6 @@
186200
{%- if compound is defined and compound -%}
187201
{%- set element = 'legend' -%}
188202
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%}
189-
{% elseif type is defined and type == 'file' %}
190-
{%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' custom-file-label')|trim}) -%}
191203
{%- else -%}
192204
{%- set label_attr = label_attr|merge({for: id}) -%}
193205
{%- endif -%}
@@ -269,15 +281,6 @@
269281
</{{ element|default('div') }}>
270282
{%- endblock form_row %}
271283

272-
{% block file_row -%}
273-
<div class="form-group">
274-
<{{ element|default('div') }} class="custom-file">
275-
{{- form_widget(form) -}}
276-
{{- form_label(form) -}}
277-
</{{ element|default('div') }}>
278-
</div>
279-
{% endblock %}
280-
281284
{# Errors #}
282285

283286
{% block form_errors -%}

0 commit comments

Comments
 (0)