diff --git a/Classes/Service/MailTemplateService.php b/Classes/Service/MailTemplateService.php index 392e924b30ebd331bf2466b8477b482226be82fa..d2956c1690bec9dfcd635ea6cf3ab7c8aea7b1d4 100644 --- a/Classes/Service/MailTemplateService.php +++ b/Classes/Service/MailTemplateService.php @@ -451,7 +451,7 @@ class MailTemplateService { * @return MailTemplateService */ public function setToAddresses($toAddresses) { - $toAddresses = preg_replace('~\x{00a0}~siu',' ', $toAddresses); + $toAddresses = preg_replace('~\x{00a0}~siu', ' ', $toAddresses); $this->toAddresses = trim($toAddresses); $this->mailMessage->setTo(trim($toAddresses)); return $this; @@ -687,7 +687,7 @@ class MailTemplateService { * @throws \BadFunctionCallException * @return array */ - public static function registerExtensions() { + public static function registerExtensions(): array { // clear registerArray $registerArray = []; @@ -735,4 +735,25 @@ class MailTemplateService { return $registerArray; } + + /** + * Checks if a template is blacklisted for a given siterootId + * + * @param string $extensionKey + * @param string $templateName + * @param int $siteRootId + * @return boolean + * @throws \InvalidArgumentException + * @throws \BadFunctionCallException + * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException + */ + public static function isTemplateBlacklisted($extensionKey, $templateName, $siteRootId): bool { + $whitelistedTemplates = BackendService::getWhitelistedTemplates($siteRootId); + + if ($whitelistedTemplates[$extensionKey]) { + return $whitelistedTemplates[$extensionKey][$templateName] ? FALSE : TRUE; + } + + return TRUE; + } }