custom/plugins/econdWebAnalytics/src/Storefront/Page/Account/Login/Subscriber/AccountLoginPageLoadedEventSubscriber.php line 24

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Ecd\econdWebAnalytics\Storefront\Page\Account\Login\Subscriber;
  3. use TypeError;
  4. use Shopware\Core\Framework\Struct\ArrayEntity;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Shopware\Storefront\Page\Account\Login\AccountLoginPageLoadedEvent;
  7. class AccountLoginPageLoadedEventSubscriber implements EventSubscriberInterface
  8. {
  9.     public static function getSubscribedEvents()
  10.     {
  11.         return [
  12.             AccountLoginPageLoadedEvent::class => 'onAccountLoginPageLoadedEvent'
  13.         ];
  14.     }
  15.     /**
  16.      * @param AccountLoginPageLoadedEvent $event
  17.      */
  18.     public function onAccountLoginPageLoadedEvent(AccountLoginPageLoadedEvent $event)
  19.     {
  20.         try {
  21.             $username['userid'] = md5($event->getRequest()->get('username'));
  22.             if($event->getRequest()->get('loginError')){
  23.                 $event->getPage()->addExtension('userid', new ArrayEntity($username) );
  24.             }
  25.         }catch (TypeError $e) {}
  26.     }
  27. }