custom/plugins/MeteorAjaxVariant/src/Subscriber/ConfigSubscriber.php line 28

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Meteor\AjaxVariant\Subscriber;
  3. use Shopware\Core\System\SystemConfig\SystemConfigService;
  4. use Shopware\Storefront\Pagelet\Footer\FooterPageletLoadedEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class ConfigSubscriber implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @var SystemConfigService
  10.      */
  11.     private $systemConfigService;
  12.     public function __construct(SystemConfigService $systemConfigService)
  13.     {
  14.         $this->systemConfigService $systemConfigService;
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             FooterPageletLoadedEvent::class => 'onFooterPageletLoadedEvent'
  20.         ];
  21.     }
  22.     public function onFooterPageletLoadedEvent(FooterPageletLoadedEvent $event): void
  23.     {
  24.         $configuration $this->systemConfigService->get(
  25.             'MeteorAjaxVariant.config',
  26.             $event->getSalesChannelContext()->getSalesChannel()->getId()
  27.         );
  28.         $event->getPagelet()->assign([
  29.             'meteorAjaxVariant' => $configuration,
  30.         ]);
  31.     }
  32. }