]> Raphaël G. Git Repositories - blogbundle/commitdiff
Add form_theme template
authorRaphaël Gertz <git@rapsys.eu>
Mon, 11 Dec 2023 06:03:27 +0000 (07:03 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 11 Dec 2023 06:03:27 +0000 (07:03 +0100)
Resources/views/form/form_div_layout.html.twig [new file with mode: 0644]

diff --git a/Resources/views/form/form_div_layout.html.twig b/Resources/views/form/form_div_layout.html.twig
new file mode 100644 (file)
index 0000000..a0ca49f
--- /dev/null
@@ -0,0 +1,17 @@
+{# vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig #}
+{% use "form_div_layout.html.twig" %}
+
+{%- block form_row -%}
+    {%- set widget_attr = {} -%}
+    {%- if help is not empty -%}
+        {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
+    {%- endif -%}
+    <div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
+        {{- form_label(form) -}}
+               <div>
+                       {{- form_widget(form, widget_attr) -}}
+                       {{- form_errors(form) -}}
+                       {{- form_help(form) -}}
+               </div>
+    </div>
+{%- endblock form_row -%}