diff --git a/src/MailService.php b/src/MailService.php index 79ce382..1b15251 100644 --- a/src/MailService.php +++ b/src/MailService.php @@ -27,7 +27,7 @@ public function gfNotificationTemplateSetting(array $fields): array { $templates = [ [ - 'label' => __('Use default template', 'lynx'), + 'label' => __('Default'), 'value' => '', ] ]; @@ -44,7 +44,7 @@ public function gfNotificationTemplateSetting(array $fields): array 'fields' => [ [ 'type' => 'select', - 'label' => __('Template', 'lynx'), + 'label' => __('Template'), 'choices' => $templates, 'name' => 'mail_template' ] @@ -69,14 +69,16 @@ public function gfNotificationApplyTemplate($email, $messageFormat, $notificatio } elseif (setting('gravityforms_default_template')) { $template = setting('gravityforms_default_template'); } else { - $template = 'mails/clean'; + $template = null; } - $mail = new Mail($template); - $mail->setSubject($email['subject']); - $mail->setContent($email['message']); + if ($template) { + $mail = new Mail($template); + $mail->setSubject($email['subject']); + $mail->setContent($email['message']); - $email['message'] = $mail->getHtml(); + $email['message'] = $mail->getHtml(); + } return $email; } diff --git a/src/Repositories/MailRepository.php b/src/Repositories/MailRepository.php index b818bcd..05c3e84 100644 --- a/src/Repositories/MailRepository.php +++ b/src/Repositories/MailRepository.php @@ -16,9 +16,9 @@ public static function getInstance(): MailRepository return self::$instance; } - public function __construct() + private function __construct() { - $this->registerTemplate('Clean', 'mails/clean'); + } public function registerTemplate(string $name, string $template)