From 7ee1ca6aac2f4999079f979c1d7c583611381175 Mon Sep 17 00:00:00 2001 From: Igor Manjencic Date: Thu, 14 Dec 2023 15:18:52 +0100 Subject: [PATCH] feat(ZMS-1711): reorganize custom templates --- .../src/Zmsentities/Helper/Messaging.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/zmsentities/src/Zmsentities/Helper/Messaging.php b/zmsentities/src/Zmsentities/Helper/Messaging.php index 73a8a2304..e730c83c4 100644 --- a/zmsentities/src/Zmsentities/Helper/Messaging.php +++ b/zmsentities/src/Zmsentities/Helper/Messaging.php @@ -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; }