custom/plugins/NetiNextEasyCoupon/src/Subscriber/PageSubscriber.php line 28

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace NetInventors\NetiNextEasyCoupon\Subscriber;
  4. use NetInventors\NetiNextEasyCoupon\Service\ConditionService\ConditionErrorService;
  5. use Shopware\Storefront\Page\GenericPageLoadedEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class PageSubscriber implements EventSubscriberInterface
  8. {
  9.     private ConditionErrorService $conditionErrorService;
  10.     public function __construct(
  11.         ConditionErrorService $conditionErrorService
  12.     ) {
  13.         $this->conditionErrorService $conditionErrorService;
  14.     }
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             GenericPageLoadedEvent::class => 'onGenericPageLoaded',
  19.         ];
  20.     }
  21.     public function onGenericPageLoaded(GenericPageLoadedEvent $event): void
  22.     {
  23.         $event->getPage()->addExtension('netiEcConditionErrorService'$this->conditionErrorService);
  24.     }
  25. }