|
| 1 | +{% extends 'form_div_layout.html.twig' %} |
| 2 | + |
| 3 | +{%- block widget_container_attributes -%} |
| 4 | + {%- set attr = attr|merge({ class: attr.class|default(block('row_class')) }) -%} |
| 5 | + {{- parent() -}} |
| 6 | +{%- endblock widget_container_attributes -%} |
| 7 | + |
| 8 | +{% block row_class %}space-y-6{% endblock row_class %} |
| 9 | + |
| 10 | +{%- block widget_attributes -%} |
| 11 | + {%- set attr = attr|merge({ class: attr.class|default(block('widget_class')) ~ (disabled ? ' ' ~ block('widget_disabled_class')) ~ (errors|length ? ' ' ~ block('widget_errors_class')) }) -%} |
| 12 | + {{- parent() -}} |
| 13 | +{%- endblock widget_attributes -%} |
| 14 | + |
| 15 | +{% block widget_class %}mt-1 w-full{% endblock widget_class %} |
| 16 | + |
| 17 | +{% block widget_disabled_class %}border-gray-300 text-gray-500{% endblock widget_disabled_class %} |
| 18 | + |
| 19 | +{% block widget_errors_class %}border-red-700{% endblock widget_errors_class %} |
| 20 | + |
| 21 | +{%- block form_label -%} |
| 22 | + {%- set label_attr = label_attr|merge({ class: label_attr.class|default(block('label_class')) }) -%} |
| 23 | + {{- parent() -}} |
| 24 | +{%- endblock form_label -%} |
| 25 | + |
| 26 | +{% block label_class %}block text-gray-800{% endblock label_class %} |
| 27 | + |
| 28 | +{%- block form_help -%} |
| 29 | + {%- set help_attr = help_attr|merge({ class: help_attr.class|default(block('help_class')) }) -%} |
| 30 | + {{- parent() -}} |
| 31 | +{%- endblock form_help -%} |
| 32 | + |
| 33 | +{% block help_class %}mt-1 text-gray-600{% endblock help_class %} |
| 34 | + |
| 35 | +{%- block form_errors -%} |
| 36 | + {%- if errors|length > 0 -%} |
| 37 | + <ul> |
| 38 | + {%- for error in errors -%} |
| 39 | + <li class="text-red-700">{{ error.message }}</li> |
| 40 | + {%- endfor -%} |
| 41 | + </ul> |
| 42 | + {%- endif -%} |
| 43 | +{%- endblock form_errors -%} |
| 44 | + |
| 45 | +{%- block date_widget -%} |
| 46 | + {%- if widget != 'single_text' -%} |
| 47 | + {%- set attr = attr|merge({ class: attr.class|default('flex space-x-1') }) -%} |
| 48 | + {%- endif -%} |
| 49 | + {{- parent() -}} |
| 50 | +{%- endblock date_widget -%} |
| 51 | + |
| 52 | +{%- block choice_widget_expanded -%} |
| 53 | + {%- set attr = attr|merge({ class: attr.class|default('mt-2') }) -%} |
| 54 | + <div {{ block('widget_container_attributes') }}> |
| 55 | + {%- for child in form %} |
| 56 | + <div class="flex items-center space-x-2"> |
| 57 | + {{- form_widget(child, { attr: { class: 'mt-0' } }) -}} |
| 58 | + {{- form_label(child, null, { translation_domain: choice_translation_domain }) -}} |
| 59 | + </div> |
| 60 | + {% endfor -%} |
| 61 | + </div> |
| 62 | +{%- endblock choice_widget_expanded -%} |
| 63 | + |
| 64 | +{%- block checkbox_row -%} |
| 65 | + {%- set widget_attr = {} -%} |
| 66 | + {%- if help is not empty -%} |
| 67 | + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} |
| 68 | + {%- endif -%} |
| 69 | + <div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}> |
| 70 | + {{- form_errors(form) -}} |
| 71 | + <div class="inline-flex items-center"> |
| 72 | + {{- form_widget(form, widget_attr) -}} |
| 73 | + {{- form_label(form) -}} |
| 74 | + </div> |
| 75 | + {{- form_help(form) -}} |
| 76 | + </div> |
| 77 | +{%- endblock checkbox_row -%} |
| 78 | + |
| 79 | +{%- block checkbox_widget -%} |
| 80 | + {%- set attr = attr|merge({ class: attr.class|default('mr-2') }) -%} |
| 81 | + {{- parent() -}} |
| 82 | +{%- endblock checkbox_widget -%} |
0 commit comments