Skip to content

Commit

Permalink
No longer default to mail/clean and fix language domain
Browse files Browse the repository at this point in the history
  • Loading branch information
maikelRAOW committed Jun 26, 2024
1 parent 56f825e commit ddb888b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function gfNotificationTemplateSetting(array $fields): array
{
$templates = [
[
'label' => __('Use default template', 'lynx'),
'label' => __('Default'),
'value' => '',
]
];
Expand All @@ -44,7 +44,7 @@ public function gfNotificationTemplateSetting(array $fields): array
'fields' => [
[
'type' => 'select',
'label' => __('Template', 'lynx'),
'label' => __('Template'),
'choices' => $templates,
'name' => 'mail_template'
]
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/MailRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ddb888b

Please sign in to comment.