Search code examples
fosuserbundlesymfony4

Symfony4 Override FosUserBundle Template


I'm following this : https://symfony.com/doc/current/bundles/FOSUserBundle/overriding_templates.html

I found the default template inside vendor/friendsofsymfony/user-bunfle/views/layout.html.twig

The documentation is then saying to place your new layout template at app/Resources/FOSUserBundle/views/layout.html.twig. Thing is, in Symfony4 there is nore more app folder I think. How should I do that then ? Thanks


Solution

  • You are right, and this is because the documentation is not updated for Symfony 4. What you need to do is copy all the templates files from vendor/friendsofsymfony/user-bundle/Resources/views and put them in a directory you create in /templates/bundles/FOSUserBundle. You can then edit the files in your newly created directory which will override the default templates.