duanjiyun7391 2014-12-18 15:18
浏览 47
已采纳

从sonata-admin的侧边菜单中删除子管理员

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条回答 默认 最新

  • duanqinjiao5244 2014-12-18 16:03
    关注

    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!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分