custom/plugins/LoyxxSW6SeoFaqManager/src/Subscribers/ProductPageLoadSeoFaqEventSubscriber.php line 37

Open in your IDE?
  1. <?php
  2. namespace LoyxxSW6SeoFaqManager\Subscribers;
  3. use LoyxxSW6SeoFaqManager\Core\Traits\EnrichCriteriaTrait;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
  6. use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepositoryInterface;
  7. use Shopware\Storefront\Page\Product\ProductLoaderCriteriaEvent;
  8. use Shopware\Storefront\Page\Product\ProductPageLoadedEvent;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class ProductPageLoadSeoFaqEventSubscriber implements EventSubscriberInterface
  11. {
  12.     use EnrichCriteriaTrait;
  13.     /**
  14.      * @var SalesChannelRepositoryInterface
  15.      */
  16.     private $productRepository;
  17.     public function __construct(SalesChannelRepositoryInterface $productRepository)
  18.     {
  19.         $this->productRepository $productRepository;
  20.     }
  21.     public static function getSubscribedEvents(): array
  22.     {
  23.         return [
  24.             ProductLoaderCriteriaEvent::class => 'onProductPageLoadedEvent'
  25.         ];
  26.     }
  27.     public function onProductPageLoadedEvent(ProductLoaderCriteriaEvent $event)
  28.     {
  29.         $this->enrichFaqCriteria($event->getCriteria());
  30.     }
  31. }