Après avoir cherché longtemps, tout ça pour une petit erreur, voici les étapes à respecter pour ajouter un Block au dashboard de Sonata Admin Bundle :
To display custom elements in the dashbord Sonata Admin uses Sonata Block Bundle. To add custom link or button you need to create a new block using Sonata Block Bundle. The core template (dashboard.html.twig) of the Admin Bundle iterates blocks that is configured to run (in config.yml of the application). Still, Admin Bundle iterates all your entity blocks in the template block_admin_list.html.twig. Creating your custom block template it is from here that you can take layout to wrap your custom groups (sections) and buttons so they have same feel as those of the entities groups.
Ok, it was introduction.
For example we want to make custom newsletter section.
There are steps:
– create new block class that implements BlockBundleInterface
– create new block template
– create block service (read and understand what are services in Symfony 2 library)
– add newly created service to Sonata Block Bundle configuration
– add newly created service to Sonata Admin Bundle configuration
– enter dashboard and enjoy new group/button/link/whatever-stuff-you-put-in-your-block-template 🙂
Ça vient de là : http://stackoverflow.com/questions/14113259/how-to-add-custom-link-or-button-to-sonataadminbundle-dashboard-in-symfony2
Et c’est franchement un truc à retenir.
Bonjour,
Merci pour ton tuto, j’essaye de comprendre comment compléter la sidebar du menu avec un menu knp. Aurais-tu une piste pour moi ?