sonata and single page

前端 未结 1 1166
粉色の甜心
粉色の甜心 2021-01-24 23:43

i\'m newbie of sonata,

i have a ContentTestAdmin with entity etc, that can only contains 4 record - record 1 - record 2 - record 3 - record 4

i already disabled

1条回答
  •  囚心锁ツ
    2021-01-25 00:40

    You should be configuring your admin menu in your app/config.yml.

    Here is an example :

    sonata_admin:
        dashboard:
            groups:
                content_test:
                    label: Content
                    icon:  ''
                    items:
                        - route: 'route_to_record1'
                          route_params: { id: 1 } #id of record 1
                          label: Record 1
                        - route: 'route_to_record_2'
                          route_params: { id: 2 }
                          label: Record 2
    

    To find out the route to a record execute the command

    app/console (bin/console on sf3) debug:router
    

    This will show you all the routes existing in your app just find the route sonata admin generated for your ContentAdmin for show or edit or whatever you need( ex: admin_content_test_show).then just fill route_params with the id of the desired record.

    (you can use that to point to any route in your app and prefill any parameters of that route)

    Hope you find this helpful

    0 讨论(0)
提交回复
热议问题