<?php declare(strict_types=1);
namespace Ultra\Store\Switcher\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use Shopware\Storefront\Event\StorefrontRenderEvent;
class Frontend implements EventSubscriberInterface{
private $systemConfigService;
public function __construct(SystemConfigService $systemConfigService) {
$this->systemConfigService = $systemConfigService;
}
public static function getSubscribedEvents(): array {
return[
StorefrontRenderEvent::class => 'onStorefrontRender'
];
}
public function onStorefrontRender(StorefrontRenderEvent $event) {
$event->setParameter('UltraStoreSwitcher', $this->systemConfigService->get('UltraStoreSwitcher.config', $event->getContext()->getSource()->getSalesChannelId()));
}
}