custom/plugins/UltraStoreSwitcher/src/Subscriber/Frontend.php line 22

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Ultra\Store\Switcher\Subscriber;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Shopware\Core\System\SystemConfig\SystemConfigService;
  5. use Shopware\Storefront\Event\StorefrontRenderEvent;
  6. class Frontend implements EventSubscriberInterface{    
  7.     private $systemConfigService;
  8.     
  9.     public function __construct(SystemConfigService $systemConfigService)    {        
  10.         $this->systemConfigService $systemConfigService;
  11.         }        
  12.         
  13.     public static function getSubscribedEvents(): array    {        
  14.         return[            
  15.             StorefrontRenderEvent::class => 'onStorefrontRender'        
  16.             ];
  17.     }    
  18.     
  19.     public function onStorefrontRender(StorefrontRenderEvent $event)    {    
  20.     
  21.        $event->setParameter('UltraStoreSwitcher'$this->systemConfigService->get('UltraStoreSwitcher.config'$event->getContext()->getSource()->getSalesChannelId()));
  22.     }
  23. }