Commit 23658b4f authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Enable templatecontent in config filees

parent 39ca138e
......@@ -296,28 +296,38 @@ class MailTemplateService {
$this->loadTemplateValues($template);
}
$defaultTemplateContent = NULL;
// get default template content from register array
$defaultTemplateContent = $registerService->getRegisterArray(
)[$this->extensionKey][$this->templateName]['templateContent'];
// var_dump($registerService->getRegisterArray()[$this->extensionKey][$this->templateName]); die();
// var_dump($defaultTemplateContent); die();
// If there is no template for this language, use the default template
if ($template === NULL) {
$templatePath = $registerService->getRegisterArray()[$this->extensionKey][$this->templateName]['templatePath'];
// only standard template file is considered since version 4.1
$defaultTemplateFile = $templatePath . 'template.html';
if (file_exists($defaultTemplateFile)) {
$defaultTemplateContent = file_get_contents($defaultTemplateFile);
} else {
// use configured default html template
/** @var TypoScriptSettingsService $typoScriptSettingsService */
$typoScriptSettingsService = $this->objectManager->get(TypoScriptSettingsService::class);
$tsSettings = $typoScriptSettingsService->getSettings(0, 'tx_sgmail');
$defaultTemplateFile = GeneralUtility::getFileAbsFileName($tsSettings['mail']['defaultHtmlTemplate']);
if ($defaultTemplateContent === NULL) {
$templatePath = $registerService->getRegisterArray(
)[$this->extensionKey][$this->templateName]['templatePath'];
// only standard template file is considered since version 4.1
$defaultTemplateFile = $templatePath . 'template.html';
if (file_exists($defaultTemplateFile)) {
$defaultTemplateContent = file_get_contents($defaultTemplateFile);
} else {
return FALSE;
// use configured default html template
/** @var TypoScriptSettingsService $typoScriptSettingsService */
$typoScriptSettingsService = $this->objectManager->get(TypoScriptSettingsService::class);
$tsSettings = $typoScriptSettingsService->getSettings(0, 'tx_sgmail');
$defaultTemplateFile = GeneralUtility::getFileAbsFileName(
$tsSettings['mail']['defaultHtmlTemplate']
);
if (file_exists($defaultTemplateFile)) {
$defaultTemplateContent = file_get_contents($defaultTemplateFile);
} else {
return FALSE;
}
}
}
} elseif (filter_var($template->getToAddress(), FILTER_VALIDATE_EMAIL)) {
$this->setToAddresses(trim($template->getToAddress()));
}
......
......@@ -84,7 +84,6 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
private function registerExtensions(): array {
$this->registerArray = [];
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sg_mail'], []);
// @TODO remove in version 5.0.0
......@@ -195,6 +194,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
$description = $configArray['description'];
$subject = $configArray['subject'];
$marker = $configArray['markers'];
$templateContent = $configArray['templateContent'];
$this->registerArray[$extensionKey][$templateKey] = [
'templatePath' => $templatePath,
......@@ -202,7 +202,8 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
'marker' => $marker,
'extension' => $extensionKey,
'templateName' => $templateKey,
'subject' => $subject
'subject' => $subject,
'templateContent' => $templateContent
];
}
......
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