Commit 979709f6 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Refactored usages of getRegisterArray

parent 3e9f51f8
......@@ -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'] !== '') {
......
......@@ -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) {
......
......@@ -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(
......
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment