Search code examples
phpsymfonyeasyadmineasyadmin3

EasyAdmin: Specifying a page in CrudController


How can I give my Crud controller a specific template?

For example, I have the user entity linked to its controller UserCrudController.

I want the creation page to be another page than the one provided by EasyAdmin by default (templates/user/new.html.twig).

How do I specify this in the CrudController ?


Solution

  • Use overrideTemplate. Example

    public function configureCrud(Crud $crud): Crud
        {
            return $crud
                // ...
                ->overrideTemplate('crud/layout', 'admin/layout.html.twig')
            ;
        }