<?php declare(strict_types=1);
namespace Ecd\econdWebAnalytics\Storefront\Page\Account\Login\Subscriber;
use TypeError;
use Shopware\Core\Framework\Struct\ArrayEntity;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Storefront\Page\Account\Login\AccountLoginPageLoadedEvent;
class AccountLoginPageLoadedEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
AccountLoginPageLoadedEvent::class => 'onAccountLoginPageLoadedEvent'
];
}
/**
* @param AccountLoginPageLoadedEvent $event
*/
public function onAccountLoginPageLoadedEvent(AccountLoginPageLoadedEvent $event)
{
try {
$username['userid'] = md5($event->getRequest()->get('username'));
if($event->getRequest()->get('loginError')){
$event->getPage()->addExtension('userid', new ArrayEntity($username) );
}
}catch (TypeError $e) {}
}
}