Search code examples
symfonysonata-adminsonata

how to create custom list with sonata admin


I can't find (understand) how to add items and cathegories to Left Side Admin Menu. There is no detailed tutorial how to do this. I can add items to sonata.admin.block.admin_list but to aside Admin Menu enter image description here


Solution

  • You need to add a route to your routing:

    admin.blog_post:
        class: db306\CoreBundle\Admin\BlogPostAdmin
        arguments: [~, db306\CoreBundle\Entity\BlogPost, ~]
        tags:
            - { name: sonata.admin, manager_type: orm, group: Content, label: Blog post }
        public: true
    
    admin.category:
        class: db306\CoreBundle\Admin\CategoryAdmin
        arguments: [~, db306\CoreBundle\Entity\Category, ~]
        tags:
            - { name: sonata.admin, manager_type: orm, group: Content, label: Category }
        public: true
    

    This will display a "Content" tab on that menu displayed on your screenshot with 2 options: 'Blog post' and 'Category'