custom/plugins/S360ListingViewSwitch/src/Storefront/Subscriber/ListingViewSubscriber.php line 29

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace S360ListingViewSwitch\Storefront\Subscriber;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Shopware\Core\Content\Product\ProductEvents;
  5. use S360ListingViewSwitch\Storefront\Helper\ViewSwitchHelper;
  6. // for initial listing opening
  7. class ListingViewSubscriber implements EventSubscriberInterface {
  8.     /**
  9.     * @var ViewSwitchHelper
  10.     */
  11.     protected $viewSwitchHelper;
  12.     public function __construct(ViewSwitchHelper $viewSwitchHelper)
  13.     {
  14.         $this->viewSwitchHelper $viewSwitchHelper;
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             ProductEvents::PRODUCT_LISTING_RESULT => 'onLoadedEvent',
  20.         ];
  21.     }
  22.     public function onLoadedEvent()
  23.     {
  24.         $this->viewSwitchHelper->checkListing();
  25.     }
  26. }