custom/plugins/ZeobvVisibleDiscounts/src/Storefront/Subscriber/StorefrontRendererSubscriber.php line 33

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Zeobv\VisibleDiscounts\Storefront\Subscriber;
  4. use Shopware\Storefront\Event\StorefrontRenderEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Zeobv\VisibleDiscounts\Service\ConfigService;
  7. use Zeobv\VisibleDiscounts\Struct\VisibleDiscountConfigStruct;
  8. class StorefrontRendererSubscriber implements EventSubscriberInterface
  9. {
  10.     private ConfigService $configService;
  11.     public function __construct(
  12.         ConfigService $configService
  13.     )
  14.     {
  15.         $this->configService $configService;
  16.     }
  17.     /**
  18.      * @return array<string>
  19.      */
  20.     public static function getSubscribedEvents(): array
  21.     {
  22.         return [
  23.             StorefrontRenderEvent::class => 'onStorefrontRender',
  24.         ];
  25.     }
  26.     public function onStorefrontRender(StorefrontRenderEvent $event): void
  27.     {
  28.         $event->setParameter('zeobvVisibleDiscountConfig', new VisibleDiscountConfigStruct($this->configService$event->getSalesChannelContext()));
  29.     }
  30. }