In this article, I suppose you have installed FosUserBundle (in composer.json : “friendsofsymfony/user-bundle”: “dev-master”). I also suppose that your symfony project is working (services enabled, security.yml configured, your bundle extends FOSUserBundle etc.)
Overriding themes:
- Take a look in FOS\UserBundle\Ressources\views\
- You will find all the templates that you need. To override one of them, simply create in your bundle, a file keeping the same path (i.e. Acme\UserBundle\Ressources\views\Security\login.html.twig). You can write everything you want inside.
- NB: The layout for FOSUserBundle is FOS\UserBundle\Ressources\views\layout.html.twig You can override it if necessary, at least to extend yours.
Overriding forms:
- Create a new file under Acme\UserBundle\Form\
- One more time you can take a look in “FOS\UserBundle\Form\” to keep the same name. It can help you to keep your files organized. Put whatever you need inside. Don’t forget to add “parent::buildForm($builder, $options);”
- Add a service corresponding to your newly created class. To avoid any mistakes go to the doc of FOSUB
- Declare your new form in config.yml
Reference:
FOSUserBundle doc Templates : https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md
FOSUserBundle doc Forms: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md