vendor/dvdw/platform-choice/src/Content/Category/Subscriber/NavigationRouteCacheKeySubscriber.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Dvdw\PlatformChoice\Content\Category\Subscriber;
  3. use Dvdw\PlatformChoice\System\SalesChannel\Struct\PlatformChoiceExtension;
  4. use Shopware\Core\Content\Category\Event\NavigationRouteCacheKeyEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class NavigationRouteCacheKeySubscriber implements EventSubscriberInterface
  7. {
  8.     public static function getSubscribedEvents(): iterable
  9.     {
  10.         return [NavigationRouteCacheKeyEvent::class => 'extendKey'];
  11.     }
  12.     public function extendKey(NavigationRouteCacheKeyEvent $event): void
  13.     {
  14.         /** @var PlatformChoiceExtension|null $extension */
  15.         $extension $event->getContext()->getExtension(PlatformChoiceExtension::KEY);
  16.         $choice PlatformChoiceExtension::B2C;
  17.         if ($extension !== null) {
  18.             $choice $extension->getChoice();
  19.         }
  20.         $event->addPart($choice);
  21.     }
  22. }