Skip to content

Commit

Permalink
feat(ZMS-1711): reorganize custom templates
Browse files Browse the repository at this point in the history
  • Loading branch information
manjencic committed Dec 14, 2023
1 parent f26c7f7 commit 7ee1ca6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions zmsentities/src/Zmsentities/Helper/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,24 @@ public static function getNotificationContent(Process $process, Config $config,

protected static function getTemplate($type, $status, ?Process $process = null)
{
$template = null;
if (Property::__keyExists($type, self::$templates)) {
if (Property::__keyExists($status, self::$templates[$type])) {
$template = self::$templates[$type][$status];
}
}

if ($process) {
$provider = $process->scope->provider;
$providerName = $provider->displayName;
$providerTemplateName = self::getProviderTemplateName($providerName);
$providerTemplate = 'custom/' . $type . '/' . $status . '/' . $providerTemplateName . '.twig';
$providerTemplateFolder = 'custom/' . $providerTemplateName . '/';

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

$template = null;
if (Property::__keyExists($type, self::$templates)) {
if (Property::__keyExists($status, self::$templates[$type])) {
$template = self::$templates[$type][$status];
}
}
return $template;
}

Expand Down

0 comments on commit 7ee1ca6

Please sign in to comment.