I create a Form builder.php like in bootstrap documentation to build my login form and my register form, like that : http://bootstrap.braincrafted.com/base-css#forms But next I discover the FOSUserBundle and I think it's maybe a good idea to use it. The problem is : I can't simply reuse the forms created before.
I want to use bootstrap to customize FOSUser template. Especially for the submit buttons, I want to add for all of them : class="btn primary large"
I create a UserBundle which override the FOSUserBundle.
I customize the login.html.twig in FOSUserBundle, putting a login.html.twig in UserBundle/Ressources/Views/Security/login.html.twig
It's easy because there is only one file for the login template.
But how I can do it for registration part for example ?
There is two files : register.html.twig and register_content.html.twig
So I create a Registration folder in my UserBundle, and I put in these two files.
But, what did I put into to change the style of the submit button ?
In register.html.twig I let :
{% extends "UserBundle::layout.html.twig" %}
{% block fos_user_content %}
{% include "UserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}
And in register_content.html.twig :
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
{{ form_widget(form) }}
<div>
<input class="btn primary large" type="submit" value="{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}" />
</div>
</form>
But it's don't work.
Did you think it's a good solution to use that bundle ? https://github.com/CCETC/FOSUserBundle
It integrate directly all the form with bootstrap style.
But if one day I want to add a field in registration form (like gender for example), could I do it in this bundle, like with the original FOSUserBundle ?
Knowing that I want to add some custom fields in register form, and customize forms with bootstrap, I'm wondering if it's a good idea to use FOSUserBundle or if it's better to build a fresh new bundle of my own to manage the user on my website.