vendor/kevinpapst/adminlte-bundle/Controller/SidebarController.php line 54

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the AdminLTE bundle.
  4.  *
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  */
  8. namespace KevinPapst\AdminLTEBundle\Controller;
  9. use KevinPapst\AdminLTEBundle\Event\ShowUserEvent;
  10. use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
  11. use KevinPapst\AdminLTEBundle\Event\SidebarUserEvent;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. class SidebarController extends EmitterController
  15. {
  16.     /**
  17.      * @return Response
  18.      */
  19.     public function userPanelAction(): Response
  20.     {
  21.         if (!$this->hasListener(SidebarUserEvent::class)) {
  22.             return new Response();
  23.         }
  24.         /** @var ShowUserEvent $userEvent */
  25.         $userEvent $this->dispatch(new SidebarUserEvent());
  26.         return $this->render(
  27.             '@AdminLTE/Sidebar/user-panel.html.twig',
  28.             [
  29.                 'user' => $userEvent->getUser(),
  30.                 'showProfileLink' => $userEvent->isShowProfileLink(),
  31.                 'showLogoutLink' => $userEvent->isShowLogoutLink(),
  32.             ]
  33.         );
  34.     }
  35.     /**
  36.      * @return Response
  37.      */
  38.     public function searchFormAction(): Response
  39.     {
  40.         return $this->render('@AdminLTE/Sidebar/search-form.html.twig', []);
  41.     }
  42.     /**
  43.      * @param Request $request
  44.      * @return Response
  45.      */
  46.     public function menuAction(Request $request): Response
  47.     {
  48.         if (!$this->hasListener(SidebarMenuEvent::class)) {
  49.             return new Response();
  50.         }
  51.         /** @var SidebarMenuEvent $event */
  52.         $event $this->dispatch(new SidebarMenuEvent($request));
  53.         return $this->render(
  54.             '@AdminLTE/Sidebar/menu.html.twig',
  55.             [
  56.                     'menu' => $event->getItems(),
  57.             ]
  58.         );
  59.     }
  60. }