|
| 1 | +{% extends "form_div_layout.html.twig" %} |
| 2 | + |
| 3 | +{%- block checkbox_row -%} |
| 4 | + {%- set parent_class = parent_class|default(attr.class|default('')) -%} |
| 5 | + {%- if 'switch-input' in parent_class -%} |
| 6 | + {{- form_label(form) -}} |
| 7 | + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' switch-input')|trim}) -%} |
| 8 | + {{- form_widget(form) -}} |
| 9 | + <label class="switch-paddle" for="{{ form.vars.id }}"></label> |
| 10 | + {{- form_errors(form) -}} |
| 11 | + {%- else -%} |
| 12 | + {{- block('form_row') -}} |
| 13 | + {%- endif -%} |
| 14 | +{%- endblock checkbox_row -%} |
| 15 | + |
| 16 | +{% block money_widget -%} |
| 17 | + {% set prepend = not (money_pattern starts with '{{') %} |
| 18 | + {% set append = not (money_pattern ends with '}}') %} |
| 19 | + {% if prepend or append %} |
| 20 | + <div class="input-group"> |
| 21 | + {% if prepend %} |
| 22 | + <span class="input-group-label">{{ money_pattern|form_encode_currency }}</span> |
| 23 | + {% endif %} |
| 24 | + {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} |
| 25 | + {{- block('form_widget_simple') -}} |
| 26 | + {% if append %} |
| 27 | + <span class="input-group-label">{{ money_pattern|form_encode_currency }}</span> |
| 28 | + {% endif %} |
| 29 | + </div> |
| 30 | + {% else %} |
| 31 | + {{- block('form_widget_simple') -}} |
| 32 | + {% endif %} |
| 33 | +{%- endblock money_widget %} |
| 34 | + |
| 35 | +{% block percent_widget -%} |
| 36 | + {%- if symbol -%} |
| 37 | + <div class="input-group"> |
| 38 | + {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} |
| 39 | + {{- block('form_widget_simple') -}} |
| 40 | + <span class="input-group-label">{{ symbol|default('%') }}</span> |
| 41 | + </div> |
| 42 | + {%- else -%} |
| 43 | + {{- block('form_widget_simple') -}} |
| 44 | + {%- endif -%} |
| 45 | +{%- endblock percent_widget %} |
| 46 | + |
| 47 | +{% block button_widget -%} |
| 48 | + {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} |
| 49 | + {{- parent() -}} |
| 50 | +{%- endblock button_widget %} |
0 commit comments