forked from MichaelYick/mailpoet
Sync automation email step settings to newsletter entity
[MAILPOET-4515]
This commit is contained in:
parent
15e4635fe3
commit
4389d3ca5f
@ -101,6 +101,24 @@ class SendEmailAction implements Action {
|
||||
}
|
||||
}
|
||||
|
||||
public function saveEmailSettings(Step $step): void {
|
||||
if ($step->getKey() !== $this->getKey()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = $step->getArgs();
|
||||
if (!isset($args['email_id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$email = $this->getEmailForStep($step);
|
||||
$email->setSubject($args['subject'] ?? '');
|
||||
$email->setPreheader($args['preheader'] ?? '');
|
||||
$email->setSenderName($args['from_name'] ?? '');
|
||||
$email->setSenderAddress($args['email'] ?? '');
|
||||
$this->newslettersRepository->flush();
|
||||
}
|
||||
|
||||
private function getEmailForStep(Step $step): NewsletterEntity {
|
||||
$emailId = $step->getArgs()['email_id'] ?? null;
|
||||
if (!$emailId) {
|
||||
|
@ -39,5 +39,8 @@ class MailPoetIntegration implements Integration {
|
||||
$registry->addSubject($this->subscriberSubject);
|
||||
$registry->addTrigger($this->segmentSubscribedTrigger);
|
||||
$registry->addAction($this->sendEmailAction);
|
||||
|
||||
// sync step args (subject, preheader, etc.) to email settings
|
||||
$registry->onBeforeWorkflowStepSave([$this->sendEmailAction, 'saveEmailSettings']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user