vendor/mrpix/shopping-city/src/Subscriber/HeaderPagelet.php line 28

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Mrpix\ShoppingCity\Subscriber;
  3. use Mrpix\ShoppingCity\Services\Navigation;
  4. use Shopware\Storefront\Pagelet\Header\HeaderPageletLoadedEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class HeaderPagelet implements EventSubscriberInterface
  7. {
  8.     private Navigation $navigationService;
  9.     public function __construct(Navigation $navigationService)
  10.     {
  11.         $this->navigationService $navigationService;
  12.     }
  13.     public static function getSubscribedEvents(): array
  14.     {
  15.         return [
  16.             HeaderPageletLoadedEvent::class => 'onHeaderPageletLoaded',
  17.         ];
  18.     }
  19.     public function onHeaderPageletLoaded(HeaderPageletLoadedEvent $event): void
  20.     {
  21.         $pagelet $event->getPagelet();
  22.         $pagelet->addArrayExtension('customNavigation'$this->navigationService->getCustomNavigation($event->getContext()));
  23.     }
  24. }