custom/plugins/MadFrontendContactForm/src/Core/Subscriber/BusinessEventCollectorSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace MadFrontendContactForm\Core\Subscriber;
  4. use MadFrontendContactForm\Core\Event\SendFrontendContactFormToCustomerEvent;
  5. use Shopware\Core\Framework\Event\BusinessEventCollector;
  6. use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. class BusinessEventCollectorSubscriber implements EventSubscriberInterface
  9. {
  10.     private BusinessEventCollector $businessEventCollector;
  11.     /**
  12.      * @param BusinessEventCollector $businessEventCollector
  13.      */
  14.     public function __construct(BusinessEventCollector $businessEventCollector)
  15.     {
  16.         $this->businessEventCollector $businessEventCollector;
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             BusinessEventCollectorEvent::NAME => ['onAddSendcontactFormtoCustomerEvent'1000],
  22.         ];
  23.     }
  24.     public function onAddSendcontactFormtoCustomerEvent(BusinessEventCollectorEvent $event): void
  25.     {
  26.         $collection $event->getCollection();
  27.         $definition $this->businessEventCollector->define(SendFrontendContactFormToCustomerEvent::class);
  28.         if (!$definition) {
  29.             return;
  30.         }
  31.         $collection->set($definition->getName(), $definition);
  32.     }
  33. }