Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonataAdmin, add menu on left

I'm working on Symfony2 and SonataAdminBundle.

I need to know how to add a menu in the left part of my dashboard ? Like in the screen :

enter image description here

I need to have the Dashboard block in the left part on the page (in dark-grey on my screen).. how can i do that ?

you can see on the demo of SonataAdmin http://demo.sonata-project.org/admin/dashboard, login admin, apssword admin

like image 907
Clément Andraud Avatar asked Aug 05 '14 14:08

Clément Andraud


3 Answers

http://blog.eike.se/2014/03/custom-page-controller-in-sonata-admin.html

this post helped me.

extend template

vendor/sonata-project/admin-bundle/Resources/views/standard_layout.html.twig

override block

{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
{% block side_bar_after_nav %}
YOUR CUSTOM MENU
{% endblock %}
like image 58
hc100 Avatar answered Oct 26 '22 23:10

hc100


I've just added ROLE_SONATA_ADMIN to ROLE_ADMIN in security.yml:

security:
    role_hierarchy:
        ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_ADMIN]

and it shown up, finaly. For more info check this: https://github.com/sonata-project/SonataAdminBundle/issues/2321

like image 31
Arkemlar Avatar answered Oct 26 '22 23:10

Arkemlar


The first thing to do is to open this file in this path:

\wamp\www\YourProject\vendor\sonata-project\admin-bundle\Resources\view \standard_layout.html.twig

Then look for :ROLE_SONATA_ADMIN (using Ctrl+F) then changed to the role that you are using to log in to your admin dashboard for me I'm using ROLE_ADMIN, then save the file, close it, check your admin dashboard, you will find exactly what you look for.

hope it will works

like image 30
Rachid Avatar answered Oct 26 '22 23:10

Rachid