Search code examples
symfonytwigfosuserbundle

Symfony 3 overwrite FOS UserTemplate - but put the Views in my Bundle


I write my own Bundle, in this bundle I need all the time the FOS User Bundle. So I put changed Forms and Entities in my Bundle. Finally I change the views from the FOS login and other pages.

I know that I have to put this in app/Resources/FOSUserBundle/views.

But my question - that I have this all in the future directly in my Bundle - is it possible to put this changed files in to my Bundle Folder? I tried under resource src/MyBundle/Resources/FOSUserBundle/views but it's not working.

Is this possible?

MF


Solution

  • There's a very standard way to override the directory structure in Symfony. It's a simple yaml file entry.

    Whether this works perfectly with FOSUserBundle, I don't know. But it's a start. Example:

    twig:
        debug:            "%kernel.debug%"
        strict_variables: "%kernel.debug%"
        paths:
          "%kernel.root_dir%/../templates": default
          "%kernel.root_dir%/../src/AppBundle/Resources/views": AppBundle
          "%kernel.root_dir%/../src/AdminBundle/Resources/views": AdminBundle