Skip to content

Instantly share code, notes, and snippets.

@livsi
Last active April 2, 2018 10:56
Show Gist options
  • Select an option

  • Save livsi/b51f7f84b8fdcc7315b53df16e7646c7 to your computer and use it in GitHub Desktop.

Select an option

Save livsi/b51f7f84b8fdcc7315b53df16e7646c7 to your computer and use it in GitHub Desktop.
Logout link in sonata admin
<?php
namespace App\EventSubscriber;
use Sonata\AdminBundle\Event\ConfigureMenuEvent;
class MenuBuilderListener
{
public function addMenuItems(ConfigureMenuEvent $event)
{
$event->getMenu()
->addChild('Logout', ['label' => 'Logout','route' => 'logout'])
->setExtras(['icon' => '<i class="fa fa-sign-out"></i>']);
}
}
services:
...
App\EventSubscriber\MenuBuilderListener:
tags:
- { name: kernel.event_listener, event: sonata.admin.event.configure.menu.sidebar, method: addMenuItems }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment