简体   繁体   English

Sonata管理员覆盖服务配置

[英]Sonata admin overwrite service configuration

I have the sonata admin bundle installed with the notifications bundle from the same vendor. 我安装了Sonata管理员捆绑包,其中包含来自同一供应商的通知捆绑包。 However I don't want to display the notification bundle on the admin panel. 但是,我不想在管理面板上显示通知包。

I know that, in order to do this, I can use: 我知道,为此,我可以使用:

show_in_dashboard="false"

I have placed it on the vendor folder and it works but I wanted to place it on the config.yml so it doesn't cause problems between server or version updates. 我已经将其放置在vendor文件夹中,并且可以使用,但是我想将其放置在config.yml中,这样就不会在服务器或版本更新之间引起问题。

Any idea on how to do this? 关于如何执行此操作的任何想法?

For whom may care the normal syntax to disable the presentation is: 对于谁可能关心禁用演示文稿的正常语法是:

<tag
                    name="sonata.admin"
                    manager_type="orm"
                    group="sonata_notification"
                    label="notifications"
                    label_translator_strategy="sonata.admin.label.strategy.underscore"
                    show_in_dashboard="false"
               />

or in yml: 或yml:

tags:
            - { name: sonata.admin, manager_type: orm, group: "Some Group", label: "", show_in_dashboard: false }

Thanks 谢谢

The way I solve this problem is by specifying explicitly in sonata_admin config which admin services to display in dashboard. 我解决此问题的方法是在sonata_admin config中显式指定要在仪表板中显示的管理服务。

sonata_admin:
dashboard:
    blocks:
        # display a dashboard block
        - { position: left, type: sonata.admin.block.admin_list }

    groups:
        some_group:
          label:  "Some group"
          items:
            - some_admin_service
            - some_other_admin_Service
        some_other_group:
          label:  "Some other group"
          items:
            ...

Some more examples can be found in documentation http://sonata-project.org/bundles/admin/2-1/doc/reference/dashboard.html 可以在文档http://sonata-project.org/bundles/admin/2-1/doc/reference/dashboard.html中找到更多示例。

You can override services definition using services.yml (in your case). 您可以使用services.yml(在您的情况下)覆盖服务定义。

1) Create file (if it not exists): app/config/services.yml 1)创建文件(如果不存在):app / config / services.yml

2) In config.yml in section "imports" add new source: 2)在“导入”部分的config.yml中,添加新的源:

imports:
- { resource: parameters.yml }
- { resource: services.yml }

3) Add service definition with 3)添加服务定义

show_in_dashboard: false

It'll override defaults from vendor 它将覆盖供应商的默认设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM