Skip to content

Commit

Permalink
Merge pull request #47435 from phreaker0/fix-mail-template-class-call
Browse files Browse the repository at this point in the history
fix(mailer): Call to custom mail_template_class
  • Loading branch information
nickvergessen authored Aug 26, 2024
2 parents c42412f + d7da934 commit 36f272d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/private/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,6 @@ public function createAttachmentFromPath(string $path, $contentType = null): IAt
* @since 12.0.0
*/
public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate {
$class = $this->config->getSystemValueString('mail_template_class', '');

if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
return new $class(
$this->defaults,
$this->urlGenerator,
$this->l10nFactory,
$emailId,
$data
);
}

$logoDimensions = $this->config->getAppValue('theming', 'logoDimensions', self::DEFAULT_DIMENSIONS);
if (str_contains($logoDimensions, 'x')) {
[$width, $height] = explode('x', $logoDimensions);
Expand All @@ -140,6 +128,20 @@ public function createEMailTemplate(string $emailId, array $data = []): IEMailTe
$logoWidth = $logoHeight = null;
}

$class = $this->config->getSystemValueString('mail_template_class', '');

if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
return new $class(
$this->defaults,
$this->urlGenerator,
$this->l10nFactory,
$logoWidth,
$logoHeight,
$emailId,
$data
);
}

return new EMailTemplate(
$this->defaults,
$this->urlGenerator,
Expand Down

0 comments on commit 36f272d

Please sign in to comment.