4

I have one EmployeeAdmin in sonata-admin, configured with three child admins:

sonata.admin.employee:
    class: Medicina\InasistenciasBundle\Admin\EmployeeAdmin
    tags:
        - { name: sonata.admin, manager_type: orm, group: "Contenido", label: "Empleados", label_translator_strategy: "sonata.admin.label.strategy.underscore" }
    arguments:
        - ~
        - Medicina\InasistenciasBundle\Entity\Employee
        - MedicinaInasistenciasBundle:EmployeeCRUD
    calls:
        - [ setTranslationDomain, [MedicinaInasistenciasBundle]]
        - [ addChild, [@sonata.admin.compensatory_part]]
        - [ addChild, [@sonata.admin.compensatory]]
        - [ addChild, [@sonata.admin.absence]]

the child admins are all pretty much the same, here's one of them:

 sonata.admin.compensatory_part:
    class: Medicina\InasistenciasBundle\Admin\CompensatoryPartAdmin
    tags:
        - { name: sonata.admin, manager_type: orm, group: "Contenido", label: "Módulos de Tiempo",label_translator_strategy: "sonata.admin.label.strategy.underscore" }
    arguments:
        - ~
        - Medicina\InasistenciasBundle\Entity\CompensatoryPart
        - MedicinaInasistenciasBundle:DeleteValidationCRUD
    calls:
        - [setTranslationDomain, [MedicinaInasistenciasBundle]]

How can I avoid the child templates from showing up in sonatas side menu?

screenshot of sonata menu

I have tried removing the group and label tags, but then sonata just sticks them in an 'Default' group with no name. I'm sure is something trivial, but I can't seem to find it in the documentation. Any ideas?

1 Answer 1

10

Add the show_in_dashboard: false tag to the Admin services you wish to exclude from the menu.

tags:
    - { name: sonata.admin, manager_type: orm, group: "Contenido", label: "Módulos de Tiempo",label_translator_strategy: "sonata.admin.label.strategy.underscore", show_in_dashboard: false }

Keep the group and label tags so they show up correctly in collections and type admins!

2
  • Thank you! I was sure it was something stupidly simple, but i couldn't find it!.
    – jlasarte
    Dec 18, 2014 at 16:12
  • 1
    @jlasarte No worries! Sonata is often terribly and confusingly documented. I don't think you would find show_in_dashboard in their docs as it currently stands.
    – sjagr
    Dec 18, 2014 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.