|
1 | | -{% use "bootstrap_base_layout.html.twig" %} |
| 1 | +{% use 'bootstrap_base_layout.html.twig' %} |
2 | 2 |
|
3 | 3 | {# Widgets #} |
4 | 4 |
|
|
123 | 123 | {%- set type = type|default('file') -%} |
124 | 124 | {%- set input_lang = 'en' -%} |
125 | 125 | {% if app is defined and app.request is defined %}{%- set input_lang = app.request.locale -%}{%- endif -%} |
126 | | - {%- set attr = {lang: input_lang} | merge(attr) -%} |
| 126 | + {%- set attr = {lang: input_lang}|merge(attr) -%} |
127 | 127 | {{- block('form_widget_simple') -}} |
128 | | - {%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim })|filter((value, key) => key != 'id') -%} |
129 | | - <label for="{{ form.vars.id }}" {% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}> |
| 128 | + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-file-label')|trim})|filter((value, key) => key != 'id') -%} |
| 129 | + <label for="{{ form.vars.id }}" {% with {attr: label_attr} %}{{ block('attributes') }}{% endwith %}> |
130 | 130 | {%- if attr.placeholder is defined and attr.placeholder is not none -%} |
131 | 131 | {{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}} |
132 | 132 | {%- endif -%} |
|
173 | 173 | {%- if 'checkbox-custom' in parent_label_class -%} |
174 | 174 | {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} |
175 | 175 | <div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' custom-control-inline' }}"> |
176 | | - {{- form_label(form, null, { widget: parent() }) -}} |
| 176 | + {{- form_label(form, null, {widget: parent()}) -}} |
177 | 177 | </div> |
178 | 178 | {%- elseif 'switch-custom' in parent_label_class -%} |
179 | 179 | {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} |
180 | 180 | <div class="custom-control custom-switch{{ 'switch-inline' in parent_label_class ? ' custom-control-inline' }}"> |
181 | | - {{- form_label(form, null, { widget: parent() }) -}} |
| 181 | + {{- form_label(form, null, {widget: parent()}) -}} |
182 | 182 | </div> |
183 | 183 | {%- else -%} |
184 | 184 | {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} |
185 | 185 | <div class="form-check{{ 'checkbox-inline' in parent_label_class ? ' form-check-inline' }}"> |
186 | | - {{- form_label(form, null, { widget: parent() }) -}} |
| 186 | + {{- form_label(form, null, {widget: parent()}) -}} |
187 | 187 | </div> |
188 | 188 | {%- endif -%} |
189 | 189 | {%- endblock checkbox_widget %} |
|
193 | 193 | {%- if 'radio-custom' in parent_label_class -%} |
194 | 194 | {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} |
195 | 195 | <div class="custom-control custom-radio{{ 'radio-inline' in parent_label_class ? ' custom-control-inline' }}"> |
196 | | - {{- form_label(form, null, { widget: parent() }) -}} |
| 196 | + {{- form_label(form, null, {widget: parent()}) -}} |
197 | 197 | </div> |
198 | 198 | {%- else -%} |
199 | 199 | {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} |
200 | 200 | <div class="form-check{{ 'radio-inline' in parent_label_class ? ' form-check-inline' }}"> |
201 | | - {{- form_label(form, null, { widget: parent() }) -}} |
| 201 | + {{- form_label(form, null, {widget: parent()}) -}} |
202 | 202 | </div> |
203 | 203 | {%- endif -%} |
204 | 204 | {%- endblock radio_widget %} |
|
233 | 233 | {% if required -%} |
234 | 234 | {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} |
235 | 235 | {%- endif -%} |
236 | | - <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}> |
| 236 | + <{{ element|default('label') }}{% if label_attr %}{% with {attr: label_attr} %}{{ block('attributes') }}{% endwith %}{% endif %}> |
237 | 237 | {{- block('form_label_content') -}} |
238 | 238 | {% block form_label_errors %}{{- form_errors(form) -}}{% endblock form_label_errors %}</{{ element|default('label') }}> |
239 | 239 | {%- else -%} |
|
256 | 256 | {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} |
257 | 257 | {%- endif %} |
258 | 258 | {%- if not compound -%} |
259 | | - {% set label_attr = label_attr|merge({'for': id}) %} |
| 259 | + {% set label_attr = label_attr|merge({for: id}) %} |
260 | 260 | {%- endif -%} |
261 | 261 | {%- if required -%} |
262 | 262 | {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} |
|
267 | 267 | {% endif %} |
268 | 268 |
|
269 | 269 | {{ widget|raw }} |
270 | | - <label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}> |
| 270 | + <label{% with {attr: label_attr} %}{{ block('attributes') }}{% endwith %}> |
271 | 271 | {%- if label is not same as(false) -%} |
272 | 272 | {{- block('form_label_content') -}} |
273 | 273 | {%- endif -%} |
|
284 | 284 | {%- endif -%} |
285 | 285 | {%- set widget_attr = {} -%} |
286 | 286 | {%- if help -%} |
287 | | - {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} |
| 287 | + {%- set widget_attr = {attr: {'aria-describedby': id ~ '_help'}} -%} |
288 | 288 | {%- endif -%} |
289 | 289 | <{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}> |
290 | 290 | {{- form_label(form) -}} |
|
312 | 312 | {% block form_help -%} |
313 | 313 | {%- if help -%} |
314 | 314 | {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-text text-muted')|trim}) -%} |
315 | | - <small id="{{ id }}_help"{% with { attr: help_attr } %}{{ block('attributes') }}{% endwith %}> |
| 315 | + <small id="{{ id }}_help"{% with {attr: help_attr} %}{{ block('attributes') }}{% endwith %}> |
316 | 316 | {{- block('form_help_content') -}} |
317 | 317 | </small> |
318 | 318 | {%- endif -%} |
|
0 commit comments