contextFactory = $contextFactory; $this->segmentSubject = $segmentSubject; $this->subscriberSubject = $subscriberSubject; $this->emailLinkSubject = $emailLinkSubject; $this->orderToSubscriberTransformer = $orderToSubscriberTransformer; $this->orderToSegmentTransformer = $orderToSegmentTransformer; $this->subscriberToWordPressUserTransformer = $subscriberToWordPressUserTransformer; $this->commentToSubscriberTransformer = $commentToSubscriberTransformer; $this->someoneSubscribesTrigger = $someoneSubscribesTrigger; $this->userRegistrationTrigger = $userRegistrationTrigger; $this->sendEmailAction = $sendEmailAction; $this->automationEditorLoadingHooks = $automationEditorLoadingHooks; $this->createAutomationRunHook = $createAutomationRunHook; $this->templatesFactory = $templatesFactory; $this->registerAnalytics = $registerAnalytics; $this->wordPress = $wordPress; } public function register(Registry $registry): void { $registry->addContextFactory('mailpoet', function () { return $this->contextFactory->getContextData(); }); $registry->addSubject($this->segmentSubject); $registry->addSubject($this->subscriberSubject); $registry->addSubject($this->emailLinkSubject); $registry->addTrigger($this->someoneSubscribesTrigger); $registry->addTrigger($this->userRegistrationTrigger); $registry->addAction($this->sendEmailAction); $registry->addSubjectTransformer($this->orderToSubscriberTransformer); $registry->addSubjectTransformer($this->orderToSegmentTransformer); $registry->addSubjectTransformer($this->subscriberToWordPressUserTransformer); $registry->addSubjectTransformer($this->commentToSubscriberTransformer); foreach ($this->templatesFactory->createTemplates() as $template) { $registry->addTemplate($template); } // sync step args (subject, preheader, etc.) to email settings $registry->onBeforeAutomationStepSave( [$this->sendEmailAction, 'saveEmailSettings'], $this->sendEmailAction->getKey() ); // execute send email step progress when email is sent $this->wordPress->addAction('mailpoet_automation_email_sent', [$this->sendEmailAction, 'handleEmailSent']); $this->automationEditorLoadingHooks->init(); $this->createAutomationRunHook->init(); $this->registerAnalytics->register(); } }