Customize Rendering


If you are not familiar with the symfony form rendering, we advice to read the How to Customize Form Rendering first before you go on.

General Config

First you need to add a file in your template folder like admin/form/form/fields.html.twig and register that file in your config.

# config/packages/enhavo.yaml

        - 'admin/form/form/fields.html.twig'

Now you are ready to customize your rendering


In your FormType, you have to add the function getBlockPrefix

# src/Form/MyFormType

class MyFormType
    // ...
    public function getBlockPrefix()
        return 'my_form'

Now you can add a block in your template file, which you registered before.

{# admin/form/form/fields.html.twig #}

{% block my_form_widget %}
    <div class="row">
        <div class="col-md-6">{{ form_row( }}</div>
        <div class="col-md-6">{{ form_row( }}</div>
{% endblock }