Custom form theme #469
Unanswered
abdellahrk
asked this question in
Q&A
Replies: 1 comment
-
Hey @abdellahrk form_builder:
form:
templates:
form_div_layout: ~ #disable other form layouts, if you want
bootstrap_3_layout: ~
bootstrap_3_horizontal_layout: ~
bootstrap_4_layout: ~
bootstrap_4_horizontal_layout: ~
tailwind_2_layout:
value: 'tailwind_2_layout.html.twig'
label: 'Tailwind'
default: true Then you've to create your theme layout here:
{% extends 'tailwind_2_layout.html.twig' %} {# use the symfony tailwind base layout #}
{% use '@FormBuilder/form/theme/type/dynamic_multi_file.html.twig' %}
{% use '@FormBuilder/form/theme/type/html_tag.html.twig' %}
{% use '@FormBuilder/form/theme/type/snippet.html.twig' %}
{% use '@FormBuilder/form/theme/type/container.html.twig' %}
{%- block form_widget_compound -%}
{# your overrides #}
{%- endblock form_widget_compound -%}
{% block checkbox_label -%}
{# your overrides #}
{%- endblock checkbox_label %}
{# more overrides #} and finally you're able to select this layout within the form area brick or if you want to place it manually: {% set config = {
form_id: 123,
form_template: 'tailwind_2_layout.html.twig',
output_workflow: 'default'
} %}
{{ form_builder_static(config) }} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am unable to use a custom theme since I am using Tailwind and want to override every field.
I get this error
when I extend the bootstrap layout with
{% extends "@!FormBuilder/form/theme/bootstrap_4_horizontal_layout.html.twig" %}
And this is how I am rendering it
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions