Skip to content

Commit 4989055

Browse files
committed
fix some minor issues with various fields in form theme
1 parent 5336293 commit 4989055

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

Resources/views/Common/Form/fields.html.twig

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,30 @@
7676

7777
{%- block choice_widget_collapsed -%}
7878
{%- spaceless -%}
79+
{%- if form.parent.vars.block_prefixes[1] == 'date' -%}
80+
<div class="col-lg-4">
81+
{{- block('choice_widget_collapsed_inner') -}}
82+
</div>
83+
{%- else -%}
84+
{%- if form.parent.vars.block_prefixes[1] == 'time' -%}
85+
<div class="col-lg-6">
86+
{{- block('choice_widget_collapsed_inner') -}}
87+
</div>
88+
{%- else -%}
89+
{{- block('choice_widget_collapsed_inner') -}}
90+
{%- endif -%}
91+
{%- endif -%}
92+
{%- endspaceless -%}
93+
{%- endblock choice_widget_collapsed -%}
94+
95+
{%- block choice_widget_collapsed_inner -%}
96+
{%- spaceless -%}
97+
{%- set attr = attr|merge({ 'class': attr.class|default('') ~ ' form-control'}) -%}
98+
7999
{%- if required and empty_value is none and not empty_value_in_choices -%}
80100
{%- set required = false -%}
81101
{%- endif -%}
82-
<select {{ block('widget_attributes') }} class="form-control"{%- if multiple %} multiple="multiple"{%- endif -%}>
102+
<select {{ block('widget_attributes') }} class="{{- attr.class -}}"{%- if multiple %} multiple="multiple"{%- endif -%}>
83103
{%- if empty_value is not none -%}
84104
<option value=""{%- if required and value is empty %} selected="selected"{%- endif -%}>{{- empty_value|trans({}, translation_domain) -}}</option>
85105
{%- endif -%}
@@ -94,7 +114,7 @@
94114
{{- block('choice_widget_options') -}}
95115
</select>
96116
{%- endspaceless -%}
97-
{%- endblock choice_widget_collapsed -%}
117+
{%- endblock choice_widget_collapsed_inner -%}
98118

99119
{%- block choice_widget_options -%}
100120
{%- spaceless -%}
@@ -128,6 +148,7 @@
128148
{%- if widget == 'single_text' -%}
129149
{{- block('form_widget_simple') -}}
130150
{%- else -%}
151+
{%- set attr = attr|merge({ 'class': attr.class|default('') ~ ' row'}) -%}
131152
<div {{ block('widget_container_attributes') -}}>
132153
{{- form_errors(form.date) -}}
133154
{{- form_errors(form.time) -}}
@@ -143,6 +164,7 @@
143164
{%- if widget == 'single_text' -%}
144165
{{- block('form_widget_simple') -}}
145166
{%- else -%}
167+
{%- set attr = attr|merge({ 'class': attr.class|default('') ~ ' row'}) -%}
146168
<div {{ block('widget_container_attributes') -}}>
147169
{{- date_pattern|replace({
148170
'{{ year }}': form_widget(form.year),
@@ -160,6 +182,7 @@
160182
{{- block('form_widget_simple') -}}
161183
{%- else -%}
162184
{%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%}
185+
{%- set attr = attr|merge({ 'class': attr.class|default('') ~ ' row'}) -%}
163186
<div {{ block('widget_container_attributes') -}}>
164187
{{- form_widget(form.hour, vars) -}}
165188
{%- if with_minutes -%}
@@ -235,9 +258,6 @@
235258
{%- spaceless -%}
236259
{%- set type = type|default('email') -%}
237260
{{- block('form_widget_simple') -}}
238-
239-
{%- set type = type|default('text') -%}
240-
<input type="{{- type -}}" value="{{- value -}}" {{ block('widget_attributes') -}} />
241261
{%- endspaceless -%}
242262
{%- endblock email_widget -%}
243263

@@ -312,7 +332,7 @@
312332
<div class="col-lg-offset-2 col-lg-10">
313333
<div class="checkbox">
314334
{{- form_errors(form) -}}
315-
<label for="label[{{- id -}}]" class="form-label">
335+
<label id="label[{{- id -}}]" for="{{- id -}}" class="form-label">
316336
{{- form_widget(form) -}}
317337
{{- label |trans({}, translation_domain) | raw -}}
318338
</label>

0 commit comments

Comments
 (0)