Skip to content

Commit e9ff079

Browse files
authored
Merge pull request #12 from tales-from-a-dev/bugfix/attr-class
🐛 Add space between block classes and custom classes
2 parents dadfd23 + c74d9f0 commit e9ff079

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

templates/form/default.html.twig

+11-11
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@
1010
{%- elseif type == 'file' -%}
1111
{%- set attr_class = block('class_input_file') -%}
1212
{%- endif -%}
13-
{%- set attr = attr|merge({'class': (attr_class ~ attr.class|default(''))|trim}) -%}
13+
{%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%}
1414
{{- parent() -}}
1515
{%- endblock form_widget_simple -%}
1616

1717
{%- block textarea_widget -%}
1818
{%- set attr_class = attr_class|default(block('class_textarea')) -%}
19-
{%- set attr = attr|merge({'class': (attr_class ~ attr.class|default(''))|trim}) -%}
19+
{%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%}
2020
{{- parent() -}}
2121
{%- endblock textarea_widget -%}
2222

2323
{%- block choice_widget_collapsed -%}
2424
{%- set attr_class = attr_class|default(block('class_select')) -%}
25-
{%- set attr = attr|merge({'class': (attr_class ~ attr.class|default(''))|trim}) -%}
25+
{%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%}
2626
{{- parent() -}}
2727
{%- endblock choice_widget_collapsed -%}
2828

2929
{%- block checkbox_widget -%}
3030
{%- set attr_class = attr_class|default(block('class_input_checkbox')) -%}
31-
{%- set attr = attr|merge({'class': (attr_class ~ attr.class|default(''))|trim}) -%}
31+
{%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%}
3232
{{- form_label(form, null, { widget: parent() }) -}}
3333
{%- endblock checkbox_widget -%}
3434

3535
{%- block radio_widget -%}
3636
{%- set attr_class = attr_class|default(block('class_input_radio')) -%}
37-
{%- set attr = attr|merge({'class': (attr_class ~ attr.class|default(''))|trim}) -%}
37+
{%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%}
3838
{{- form_label(form, null, { widget: parent() }) -}}
3939
{%- endblock radio_widget -%}
4040

@@ -86,9 +86,9 @@
8686
{%- endif -%}
8787
<div {{ block('widget_container_attributes') }}>
8888
{{- date_pattern|replace({
89-
'{{ year }}': form_widget(form.year, { attr: { class: ' rounded-none rounded-r-lg' ~ attr_class_error }}),
90-
'{{ month }}': form_widget(form.month, { attr: { class: ' rounded-none rounded-l-lg' ~ attr_class_error }}),
91-
'{{ day }}': form_widget(form.day, { attr: { class: ' rounded-none' ~ attr_class_error }}),
89+
'{{ year }}': form_widget(form.year, { attr: { class: 'rounded-none rounded-r-lg' ~ attr_class_error }}),
90+
'{{ month }}': form_widget(form.month, { attr: { class: 'rounded-none rounded-l-lg' ~ attr_class_error }}),
91+
'{{ day }}': form_widget(form.day, { attr: { class: 'rounded-none' ~ attr_class_error }}),
9292
})|raw -}}
9393
</div>
9494
{%- endif -%}
@@ -104,14 +104,14 @@
104104
{%- set attr_class_error = ' ' ~ block('class_input_error') -%}
105105
{%- endif -%}
106106
<div {{ block('widget_container_attributes') }}>
107-
{{- form_widget(form.hour, { attr: { class: (with_minutes or with_seconds ? ' rounded-none rounded-l-lg' : '') ~ attr_class_error }}) -}}
107+
{{- form_widget(form.hour, { attr: { class: (with_minutes or with_seconds ? 'rounded-none rounded-l-lg' : '') ~ attr_class_error }}) -}}
108108
{%- if with_minutes -%}
109109
<span class="{{ block('class_time_separator') }}">:</span>
110-
{{- form_widget(form.minute, { attr: { class: (with_seconds ? ' rounded-none' : ' rounded-none rounded-r-lg') ~ attr_class_error }}) -}}
110+
{{- form_widget(form.minute, { attr: { class: (with_seconds ? 'rounded-none' : 'rounded-none rounded-r-lg') ~ attr_class_error }}) -}}
111111
{%- endif -%}
112112
{%- if with_seconds -%}
113113
<span class="{{ block('class_time_separator') }}">:</span>
114-
{{- form_widget(form.second, { attr: { class: ' rounded-none rounded-r-lg' ~ attr_class_error }}) -}}
114+
{{- form_widget(form.second, { attr: { class: 'rounded-none rounded-r-lg' ~ attr_class_error }}) -}}
115115
{%- endif -%}
116116
</div>
117117
{%- endif -%}

0 commit comments

Comments
 (0)