custom/plugins/OkeonlineKejeLogin/src/Storefront/Page/Subscriber/GenericPageLoadedEventSubscriber.php line 28

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Okeonline\KejeLogin\Storefront\Page\Subscriber;
  3. use Shopware\Core\Framework\Struct\ArrayStruct;
  4. use Shopware\Core\System\SystemConfig\SystemConfigService;
  5. use Shopware\Storefront\Page\GenericPageLoadedEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class GenericPageLoadedEventSubscriber implements EventSubscriberInterface
  8. {
  9.     protected $systemConfigService;
  10.     public function __construct(
  11.         SystemConfigService $systemConfigService
  12.     )
  13.     {
  14.         $this->systemConfigService $systemConfigService;
  15.     }
  16.     public static function getSubscribedEvents()
  17.     {
  18.         return [
  19.             GenericPageLoadedEvent::class => 'onPageLoaded'
  20.         ];
  21.     }
  22.     public function onPageLoaded(GenericPageLoadedEvent $event)
  23.     {
  24.         if($event->getRequest()->get('_route') !== 'frontend.account.login.page'){
  25.             return;
  26.         }
  27.         $event->getPage()->addExtension('OkeonlineKejeLogin', new ArrayStruct([
  28.             'active' => $this->systemConfigService->get('OkeonlineKejeLogin.config.active'),
  29.             'identifier' => $this->systemConfigService->get('OkeonlineKejeLogin.config.identifier'),
  30.             'identifierLabel' => $this->systemConfigService->get('OkeonlineKejeLogin.config.identifierLabel')
  31.         ]));
  32.     }
  33. }