<?php declare(strict_types=1);
namespace WebkulKeyCloakSSO\Subscriber;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Storefront\Pagelet\Footer\FooterPageletLoadedEvent;
class AccountPageSubscriber implements EventSubscriberInterface
{
/**
* @var SystemConfigService
*/
private $systemConfigService;
public function __construct(SystemConfigService $systemConfigService)
{
$this->systemConfigService = $systemConfigService;
}
public static function getSubscribedEvents(): array
{
return [
FooterPageletLoadedEvent::class => 'onAccountPageLoaded'
];
}
public function onAccountPageLoaded(FooterPageletLoadedEvent $event): void
{
$wkKeyCloakSSOConfig = $this->systemConfigService->get('WebkulKeyCloakSSO.config');
// echo '<pre>';
// print_r(get_class_methods($event->getPagelet()));
// echo '</pre>';
// die();
$event->getPagelet()->assign($wkKeyCloakSSOConfig, 'wkKeyCloakSSOConfig');
}
}