You can check this URL: http://symfony.com/doc/2.0/cookbook/form/form_customization.html#cookbook-form-theming-methods
Here is a paragraph about setting form_row ().
Here is a simple example. By default, form_row () will create a simple html structure as follows:
TWIG:
{{ form_row(form.email, { 'label' : 'Your email address' }) }}
HTML:
<div> <label for="register_email" class=" required">Your email address</label> <input type="email" id="register_email" name="register[email]" required="required" /> </div>
So, according to the docs, you can create a new branch template and add class = "form_row" to the field and label environment. Put it in YourBundle / views / Form / fields.html.twig and put the following code here:
{% block field_row %} <div class="form_row"> {{ form_label(form) }} {{ form_errors(form) }} {{ form_widget(form) }} </div> {% endblock field_row %}
In the template file, add the following line:
{% form_theme form 'YourBundle:Form:fields.html.twig' %}
Now the form_row template from the file you created will be used and will return the following HTML code:
<div class="form_row"> <label for="register_email" class=" required">Email</label> <input type="email" id="register_email" name="register[email]" required="required" /> </div>
Hope this helps.
source share