0
votes

In SonataAdmin, the documentation lists three ways of puting custom items in the menu: by configuration, by menu providers, and by events.

Using configuration (or providers) means specifying groups by hand in config, like this:

sonata_admin:
    dashboard:
        groups:
            news:
                label:                ~
                label_catalogue:      ~
                items:
                    - sonata.news.admin.post
                    - route:        blog_home
                      label:        Blog
                    - route:        blog_article
                      route_params: { articleId: 3 }
                      label:        Article

(https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_knp_menu.html)

But as soon as you declare a non-empty groups array in the config, it overrides the auto generated groups, guessed from the Admin Service Pool.

Is there a way to add groups by hand in the config file, while keeping the groups defined by Admin Services?

Thank you everyone for your time.

1

1 Answers

0
votes

The answer is no.

The only option is to use the item_adds entry inside of a group. But that doesn't solve the initial problem.

My advise: do not use auto generated groups. Instead, define them by hand in the config, with some nice built name like sonata.admin.groups.news and them refer to them in the service declaration:

        tags:
            - { name: sonata.admin, manager_type: orm, group: sonata.admin.groups.news, label: "News" }