custom/plugins/RpayPayments/src/Components/AdminOrders/Subscriber/PageSubscriber.php line 35

Open in your IDE?
  1. <?php
  2. /*
  3.  * Copyright (c) Ratepay GmbH
  4.  *
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  */
  8. namespace Ratepay\RpayPayments\Components\AdminOrders\Subscriber;
  9. use Shopware\Storefront\Event\StorefrontRenderEvent;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  12. class PageSubscriber implements EventSubscriberInterface
  13. {
  14.     private SessionInterface $session;
  15.     private string $sessionKey;
  16.     public function __construct(SessionInterface $sessionstring $sessionKey)
  17.     {
  18.         $this->session $session;
  19.         $this->sessionKey $sessionKey;
  20.     }
  21.     public static function getSubscribedEvents(): array
  22.     {
  23.         return [
  24.             StorefrontRenderEvent::class => 'onPage',
  25.         ];
  26.     }
  27.     public function onPage(StorefrontRenderEvent $event): void
  28.     {
  29.         $event->setParameter('ratepayAdminOrderSession'$this->session->get($this->sessionKey) === true);
  30.     }
  31. }