S
S
symnoob2021-10-05 22:52:46
symfony
symnoob, 2021-10-05 22:52:46

How to rewrite Template / Theme forms?

Hello everyone, I can’t understand how and where to find blocks for customizing form rendering?

And how do I redraw the Theme of the form?

For example, a simple example, how to remake the label of the field here so that it is rendered as a placeholder?

At the moment I do it this way, but it is somehow stupid, and in many cases it is not at all suitable

{% form_theme content.snippet.form 'bootstrap_5_layout.html.twig' %}
 {{ form_start(content.snippet.form) }}

{{ form_row(content.snippet.form.firstName, {'attr': {'placeholder': content.snippet.form.firstName.vars.label}, label:false  }) }}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2021-10-06
@symnoob

https://symfony.com/doc/current/form/form_themes.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question