![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/FormBundle/EventListener/ |
<?php namespace Mautic\FormBundle\EventListener; use Mautic\FormBundle\Event\SubmissionEvent; use Mautic\FormBundle\FormEvents; use Mautic\WebhookBundle\Event\WebhookBuilderEvent; use Mautic\WebhookBundle\Model\WebhookModel; use Mautic\WebhookBundle\WebhookEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class WebhookSubscriber implements EventSubscriberInterface { public function __construct( private WebhookModel $webhookModel ) { } public static function getSubscribedEvents(): array { return [ WebhookEvents::WEBHOOK_ON_BUILD => ['onWebhookBuild', 0], FormEvents::FORM_ON_SUBMIT => ['onFormSubmit', 0], ]; } /** * Add event triggers and actions. */ public function onWebhookBuild(WebhookBuilderEvent $event): void { // add checkbox to the webhook form for new leads $formSubmit = [ 'label' => 'mautic.form.webhook.event.form.submit', 'description' => 'mautic.form.webhook.event.form.submit_desc', ]; // add it to the list $event->addEvent(FormEvents::FORM_ON_SUBMIT, $formSubmit); } public function onFormSubmit(SubmissionEvent $event): void { $this->webhookModel->queueWebhooksByType( FormEvents::FORM_ON_SUBMIT, [ 'submission' => $event->getSubmission(), ], [ 'submissionDetails', 'ipAddress', 'leadList', 'pageList', 'formList', ] ); } }