This component uses the same setup as the Navbar User except for the event name it listens to.
Edit the previously made class NavbarUserSubscriber
and register it for another event:
<?php
// src/EventSubscriber/NavbarUserSubscriber.php
namespace App\EventSubscriber;
use KevinPapst\AdminLTEBundle\Event\NavbarUserEvent;
use KevinPapst\AdminLTEBundle\Event\SidebarUserEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class NavbarUserSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
NavbarUserEvent::class => ['onShowUser', 100],
SidebarUserEvent::class => ['onShowUser', 100],
];
}
// ... the rest of the class follows here ...
}
If your application is using the classical approach of manually registering Services and EventListener use this method.
Just add the following listener definition to the event system in config/services.yaml
and you're good to go:
services:
app.show_user_listener:
class: App\EventListener\NavbarUserListener
tags:
- { name: kernel.event_listener, event: theme.sidebar_user, method: onShowUser }
Please go back to the AdminLTE bundle documentation to find out more about using the theme.