Skip to content
Snippets Groups Projects
Commit 3e256177 authored by Paul Ilea's avatar Paul Ilea
Browse files

[FEATURE] Configrable Excluded Templates from BE Module

parent 51494625
No related branches found
No related tags found
1 merge request!5[FEATURE] Configrable Excluded Templates from BE Module
......@@ -87,6 +87,27 @@ class MailController extends ActionController {
}
$registerArray = MailTemplateService::getRegisterArray();
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sg_mail'], [FALSE]);
if (isset($extensionConfiguration['excludeTemplates']) && $extensionConfiguration['excludeTemplates'] !== '') {
$excludedTemplates = GeneralUtility::trimExplode(',', $extensionConfiguration['excludeTemplates'], TRUE);
if ($excludedTemplates && count($excludedTemplates)) {
foreach ($excludedTemplates as $excludedTemplate) {
list($extensionKey, $templateName) = GeneralUtility::trimExplode('.', $excludedTemplate);
if ($extensionKey && $templateName && isset($registerArray[$extensionKey][$templateName])) {
unset($registerArray[$extensionKey][$templateName]);
}
}
}
}
$removeExtensionKeys = [];
foreach($registerArray as $extensionKey => $extensionTemplates) {
if (count($extensionTemplates) === 0) {
$removeExtensionKeys[] = $extensionKey;
}
}
foreach($removeExtensionKeys as $extensionKey) {
unset($registerArray[$extensionKey]);
}
// if no extensions are registered, redirect to empty action
if (empty($registerArray)) {
......@@ -148,7 +169,7 @@ class MailController extends ActionController {
$this->view->assign('colspace', $colspace);
$this->view->assign('languageTemplates', $templates);
$this->view->assign('languageLabels', BackendService::getLanguageLabels($languages));
$this->view->assign('templates', MailTemplateService::getRegisterArray());
$this->view->assign('templates', $registerArray);
$templateDescription = $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']]['description'];
......
......@@ -309,6 +309,10 @@
<source>Example</source>
<target>Beispiel</target>
</trans-unit>
<trans-unit id="configuration.excludeTemplates">
<source>Exclude Mail Templates:Comma-separated list of {extension_key}.{template_name}</source>
<target>Mail-Templates ausschließen:Kommagetrennte Liste von {extension_key}.{template_name}</target>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr" approved="yes">
<source>Mail Templates</source>
<target>Mail-Templates</target>
......
......@@ -234,6 +234,9 @@
<trans-unit id="backend.value">
<source>Example</source>
</trans-unit>
<trans-unit id="configuration.excludeTemplates">
<source>Exclude Mail Templates:Comma-separated list of {extension_key}.{template_name}</source>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr">
<source>Mail Templates</source>
</trans-unit>
......
# cat=general; type=string; label=LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:configuration.excludeTemplates
excludeTemplates =
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment