Search code examples
twigsonata-adminextends

Sonata admin: extends template gives following error "Variable "base_template" does not exist"


I am having an issue with overriding a template with Sonata. I am trying to extend " SonataAdminBundle:CRUD:edit.html.twig", but I get the following error : "Variable "base_template" does not exist". However, here is the documentation : " if you look closely, all of these templates ultimately extend the base_template variable that’s passed from the controller. This variable will always take the value of one of the above mentioned global templates, and this is how changes made to those files affect all the SonataAdminBundle interface."

Here is the exemple given by the documentation :

    {% extends 'SonataAdminBundle:CRUD:edit.html.twig' %}

Which is exactely what I copied in my field EditParameterSetAdmin.html.twig, which I call that way :

            tamas_astro.admin.parameterSet:
               class: TAMAS\AstroBundle\Admin\ParameterSetAdmin
               arguments: [null, TAMAS\AstroBundle\Entity\ParameterSet, 
               "TAMASAstroBundle:CRUD"]
               tags:
                    - { name: sonata.admin, manager_type: orm, label: 
                    Parameter Set, group: Parameter }
               public: true
               calls:
                    - [ setTemplate, [edit, 
                    TAMASAstroBundle:Admin:EditParameterSetAdmin.html.twig]]

Does anyone sees what I did wrong ? Thanks


Solution

  • The main thing you should always remember - clear the cache! Especially, when you work with html!