Skip to content

Commit

Permalink
Merge pull request #67 from it-at-m/feature-1711-custom-mail-templates
Browse files Browse the repository at this point in the history
feat(ZMS-1711): fix loading template
  • Loading branch information
manjencic authored Dec 13, 2023
2 parents 7ed31ea + 29d66c8 commit cc82254
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zmsentities/src/Zmsentities/Helper/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,13 @@ public static function getNotificationContent(Process $process, Config $config,
protected static function getTemplate($type, $status, ?Process $process = null)
{
if ($process) {
$scopeName = $process->getCurrentScope()->getName();
$scopeName = str_replace(['(', ')', '/'], '', $scopeName);
$scopeTemplate = 'custom/' . $type . '/' . $status . '/' . $scopeName . '.twig';
$provider = $process->getCurrentScope()->getProvider();
$providerName = $provider->getDisplayName() ?? $provider->getName();
$providerName = str_replace(['(', ')', '/'], '', $providerName);
$providerTemplate = 'custom/' . $type . '/' . $status . '/' . $providerName . '.twig';

if (file_exists(TemplateFinder::getTemplatePath() . '/messaging/' . $scopeTemplate)) {
return $scopeTemplate;
if (file_exists(TemplateFinder::getTemplatePath() . '/messaging/' . $providerTemplate)) {
return $providerTemplate;
}
}

Expand Down

0 comments on commit cc82254

Please sign in to comment.