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

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