diff --git a/Classes/Service/BackendService.php b/Classes/Service/BackendService.php index fc7eb062b61ea12f735e987d449f2b503aed8232..fe839507357d647d82f69d111d9485890d322b3a 100644 --- a/Classes/Service/BackendService.php +++ b/Classes/Service/BackendService.php @@ -410,7 +410,9 @@ class BackendService { */ public static function getNonBlacklistedTemplates($siteRootId): array { $siteRootId = (int) $siteRootId; - $registerArray = MailTemplateService::getRegisterArray(); + + $registerService = GeneralUtility::makeInstance(RegisterService::class); + $registerArray = $registerService->getRegisterArray(); $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sg_mail'], []); if (isset($extensionConfiguration['excludeTemplates']) && $extensionConfiguration['excludeTemplates'] !== '') { diff --git a/Classes/Service/MailTemplateService.php b/Classes/Service/MailTemplateService.php index 5554779f3c53d4ca0ad9840109fd39bc6fdc47b1..7842bd250af2f0fa344b9ce694e0ffac923a6641 100644 --- a/Classes/Service/MailTemplateService.php +++ b/Classes/Service/MailTemplateService.php @@ -256,6 +256,8 @@ class MailTemplateService { * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ public function sendEmail($isPreview = FALSE): bool { + $registerService = GeneralUtility::makeInstance(RegisterService::class); + if (TYPO3_MODE === 'FE') { /** @var TypoScriptFrontendController $tsfe */ $tsfe = $GLOBALS['TSFE']; @@ -297,8 +299,7 @@ class MailTemplateService { $defaultTemplateContent = NULL; // If there is no template for this language, use the default template if ($template === NULL) { - - $templatePath = self::getRegisterArray()[$this->extensionKey][$this->templateName]['templatePath']; + $templatePath = $registerService->getRegisterArray()[$this->extensionKey][$this->templateName]['templatePath']; // only standard template file is considered since version 4.1 $defaultTemplateFile = $templatePath . 'template.html'; @@ -324,7 +325,8 @@ class MailTemplateService { if ($isPreview) { $previewMarker = []; /** @var array $markerArray */ - $markerArray = self::getRegisterArray()[$this->extensionKey][$this->templateName]['marker']; + + $markerArray = $registerService->getRegisterArray()[$this->extensionKey][$this->templateName]['marker']; foreach ($markerArray as $marker) { $markerPath = GeneralUtility::trimExplode('.', $marker['marker']); $temporaryMarkerArray = []; @@ -358,10 +360,10 @@ class MailTemplateService { $emailView->setTemplateSource($template->getContent()); } else { - $subject = self::getRegisterArray()[$this->extensionKey][$this->templateName]['subject']; + $subject = $registerService->getRegisterArray()[$this->extensionKey][$this->templateName]['subject']; if (\is_array($subject)) { $subject = \trim( - self::getRegisterArray()[$this->extensionKey][$this->templateName]['subject'][$this->language] + $registerService->getRegisterArray()[$this->extensionKey][$this->templateName]['subject'][$this->language] ); } if ($subject === NULL && $this->subject !== NULL) { diff --git a/Classes/Service/RegisterService.php b/Classes/Service/RegisterService.php index e4b8831cc6176858fa74040002a2ce7e5f48d4f1..e4ffc4356590fae3642e5be93db211c335d5faef 100644 --- a/Classes/Service/RegisterService.php +++ b/Classes/Service/RegisterService.php @@ -124,7 +124,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { } } - // @TODO read automatically created extension registrations and write the entries + // read automatically created extension registrations and write the entries // get the location where automatic registrations should be stored $configurationLocation = $this->getRegistrationPath(); $registerFolder = GeneralUtility::getFileAbsFileName( diff --git a/Classes/UserFunc/ExtensionConfiguration.php b/Classes/UserFunc/ExtensionConfiguration.php index 3e01d938b00b6e82398dab43472c00c9a41eca47..09cde55820ffec667623d5e2cd24f57f40037e6a 100644 --- a/Classes/UserFunc/ExtensionConfiguration.php +++ b/Classes/UserFunc/ExtensionConfiguration.php @@ -24,6 +24,9 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use SGalinski\SgMail\Service\RegisterService; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Class ExtensionConfiguration * @@ -40,7 +43,8 @@ class ExtensionConfiguration { $result = ''; try { - $registerArray = \SGalinski\SgMail\Service\MailTemplateService::getRegisterArray(); + $registerService = GeneralUtility::makeInstance(RegisterService::class); + $registerArray = $registerService->getRegisterArray(); foreach ($registerArray as $extensionKey => $extension) { /** @var array $extension */ foreach ($extension as $templateKey => $template) {