vendor/gourmops/product-short-description/src/Subscriber/FooterPageletSubscriber.php line 34

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * GourmopsProductShortDescription
  4.  * Copyright (c) Simone Gottwald GOURMOPS
  5.  */
  6. namespace GourmopsProductShortDescription\Subscriber;
  7. use GourmopsProductShortDescription\GourmopsProductShortDescription;
  8. use Shopware\Core\Framework\Struct\ArrayStruct;
  9. use Shopware\Storefront\Pagelet\Footer\FooterPagelet;
  10. use Shopware\Storefront\Pagelet\Footer\FooterPageletLoadedEvent;
  11. /**
  12.  * Class FooterPageletSubscriber
  13.  */
  14. class FooterPageletSubscriber extends AbstractSubscriber
  15. {
  16.     /**
  17.      * @return string[]
  18.      */
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             FooterPageletLoadedEvent::class => 'onFooterPageletLoaded',
  23.         ];
  24.     }
  25.     /**
  26.      * @param FooterPageletLoadedEvent $event
  27.      *
  28.      * @return void
  29.      */
  30.     public function onFooterPageletLoaded(FooterPageletLoadedEvent $event): void
  31.     {
  32.         /** @var array $config */
  33.         $config $this->getConfig($event->getSalesChannelContext());
  34.         /** @var FooterPagelet $footerPagelet */
  35.         $footerPagelet $event->getPagelet();
  36.         if (empty($config) ||
  37.             empty($config['activated'])
  38.         ) {
  39.             return;
  40.         }
  41.         $footerPagelet->addExtension(GourmopsProductShortDescription::FIELD_PLACEHOLDER, new ArrayStruct());
  42.     }
  43. }