vendor/store.shopware.com/huebertseofaq/src/Subscriber/FooterPageletSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. namespace Huebert\SeoFaq\Subscriber;
  3. use Shopware\Storefront\Page\GenericPageLoadedEvent;
  4. use Shopware\Storefront\Pagelet\Footer\FooterPageletLoadedEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Shopware\Core\System\SystemConfig\SystemConfigService;
  7. class FooterPageletSubscriber implements EventSubscriberInterface
  8. {
  9.     /*
  10.      * @var SystemConfigService
  11.      */
  12.     private $systemConfig;
  13.     // add the `SystemConfigService` to your constructor
  14.     public function __construct(SystemConfigService $systemConfig)
  15.     {
  16.         $this->systemConfig $systemConfig;
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             FooterPageletLoadedEvent::class => 'onPageLoaded'
  22.         ];
  23.     }
  24.     public function onPageLoaded(FooterPageletLoadedEvent $pageLoadedEvent) {
  25.         //assign HuebertSeoFaq config keys
  26.         $config $this->systemConfig->get('HuebertSeoFaq.config'$pageLoadedEvent->getSalesChannelContext()->getSalesChannel()->getId());
  27.         if($config) {$pageLoadedEvent->getPagelet()->assign(['HuebertSeoFaq' => ['config' => $config]]);}
  28.     }
  29. }