|
39 | 39 | {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%}
|
40 | 40 | {% set valid = true %}
|
41 | 41 | {%- endif -%}
|
42 |
| - {{- parent() -}} |
| 42 | + |
| 43 | + {%- if widget == 'single_text' -%} |
| 44 | + {{- block('form_widget_simple') -}} |
| 45 | + {%- else -%} |
| 46 | + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} |
| 47 | + <div {{ block('widget_container_attributes') }}> |
| 48 | + <div class="table-responsive"> |
| 49 | + <table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}"> |
| 50 | + <thead> |
| 51 | + <tr> |
| 52 | + {%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%} |
| 53 | + {%- if with_months %}<th>{{ form_label(form.months) }}</th>{% endif -%} |
| 54 | + {%- if with_weeks %}<th>{{ form_label(form.weeks) }}</th>{% endif -%} |
| 55 | + {%- if with_days %}<th>{{ form_label(form.days) }}</th>{% endif -%} |
| 56 | + {%- if with_hours %}<th>{{ form_label(form.hours) }}</th>{% endif -%} |
| 57 | + {%- if with_minutes %}<th>{{ form_label(form.minutes) }}</th>{% endif -%} |
| 58 | + {%- if with_seconds %}<th>{{ form_label(form.seconds) }}</th>{% endif -%} |
| 59 | + </tr> |
| 60 | + </thead> |
| 61 | + <tbody> |
| 62 | + <tr> |
| 63 | + {%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%} |
| 64 | + {%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%} |
| 65 | + {%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%} |
| 66 | + {%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%} |
| 67 | + {%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%} |
| 68 | + {%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%} |
| 69 | + {%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%} |
| 70 | + </tr> |
| 71 | + </tbody> |
| 72 | + </table> |
| 73 | + </div> |
| 74 | + {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} |
| 75 | + </div> |
| 76 | + {%- endif -%} |
43 | 77 | {%- endblock dateinterval_widget %}
|
44 | 78 |
|
45 | 79 | {% block percent_widget -%}
|
|
125 | 159 | {# Labels #}
|
126 | 160 |
|
127 | 161 | {% block form_label -%}
|
128 |
| - {%- if compound is defined and compound -%} |
129 |
| - {%- set element = 'legend' -%} |
130 |
| - {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-legend')|trim}) -%} |
131 |
| - {%- else -%} |
132 |
| - {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} |
| 162 | + {% if label is not same as(false) -%} |
| 163 | + {%- if compound is defined and compound -%} |
| 164 | + {%- set element = 'legend' -%} |
| 165 | + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-legend')|trim}) -%} |
| 166 | + {%- else -%} |
| 167 | + {%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} |
| 168 | + {%- endif -%} |
| 169 | + {% if required -%} |
| 170 | + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} |
| 171 | + {%- endif -%} |
| 172 | + {% if label is empty -%} |
| 173 | + {%- if label_format is not empty -%} |
| 174 | + {% set label = label_format|replace({ |
| 175 | + '%name%': name, |
| 176 | + '%id%': id, |
| 177 | + }) %} |
| 178 | + {%- else -%} |
| 179 | + {% set label = name|humanize %} |
| 180 | + {%- endif -%} |
| 181 | + {%- endif -%} |
| 182 | + <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}{% block form_label_errors %}{{- form_errors(form) -}}{% endblock form_label_errors %}</{{ element|default('label') }}> |
133 | 183 | {%- endif -%}
|
134 |
| - {{- parent() -}} |
135 | 184 | {%- endblock form_label %}
|
136 | 185 |
|
137 | 186 | {% block checkbox_radio_label -%}
|
|
169 | 218 | <{{ element|default('div') }} class="form-group">
|
170 | 219 | {{- form_label(form) -}}
|
171 | 220 | {{- form_widget(form) -}}
|
172 |
| - {{- form_errors(form) -}} |
173 | 221 | </{{ element|default('div') }}>
|
174 | 222 | {%- endblock form_row %}
|
175 | 223 |
|
|
0 commit comments