How can I override the layout of the registration form
Currently the form is
-username
-email
-password
-verification
I want the override the layout of this form, lets say, two questions per row
-username -email
additional text
-password -verification
I understand how to write the views (twigs) register.html.twig calls register_content.html.twig which uses;
{{ form_widget(form) }}
how do i override the
{{ form_widget(form) }}
?
You have to override FosUserBundle registration form template.
You can accomplish an override in the following ways:
Define a template with same name into app/resources directory. Together "same name" you have to reproduce the same structure of the bundle. So, if your template is in, i.e., FosUserBundle/views/mainTemplate.html.twig you have to override it by creating a new one template in app/resources/FosUserBundle/views and call it mainTemplate.html.twig
You have to create a new bundle from scratch and override getParent() method that have to return a string containing bundle name that you want to override ( FosUserBundle ). Now if you create a new template in the same position of the original, you have overwritten it. This method is not recommended since you have to override controller also.