Skip to content
Snippets Groups Projects
Commit 4c3d0f32 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Refactoring naming and removing unnecessary default template creation

parent 07ddf861
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ class MailTemplateService { ...@@ -91,7 +91,7 @@ class MailTemplateService {
/** /**
* @var array content * @var array content
*/ */
private $content = []; private $markers = [];
/** /**
* @var string subject * @var string subject
...@@ -113,24 +113,18 @@ class MailTemplateService { ...@@ -113,24 +113,18 @@ class MailTemplateService {
* @param string $templateName * @param string $templateName
* @param string $templatePath * @param string $templatePath
* @param string $description * @param string $description
* @param array $marker * @param array $markers
* @return string * @return string
*/ */
public static function registerTemplate($extension, $templateName, $templatePath, $description, array $marker) { public static function registerTemplate($extension, $templateName, $templatePath, $description, array $markers) {
MailTemplateService::$registerArray[$extension][$templateName] = [ MailTemplateService::$registerArray[$extension][$templateName] = [
'templatePath' => $templatePath, 'templatePath' => $templatePath,
'description' => $description, 'description' => $description,
'marker' => $marker, 'marker' => $markers,
'extension' => $extension, 'extension' => $extension,
'templateName' => $templateName 'templateName' => $templateName
]; ];
$defaultLangFile = $templatePath . 'en.sg_mail.locallang.html';
if (!file_exists($defaultLangFile)) {
$langFileContent = '';
file_put_contents($defaultLangFile, $langFileContent);
}
} }
/** /**
...@@ -143,7 +137,7 @@ class MailTemplateService { ...@@ -143,7 +137,7 @@ class MailTemplateService {
} }
/** /**
* send the Email * Send the Email
*/ */
public function sendEmail() { public function sendEmail() {
$registerArray = MailTemplateService::getRegisterArray(); $registerArray = MailTemplateService::getRegisterArray();
...@@ -154,7 +148,7 @@ class MailTemplateService { ...@@ -154,7 +148,7 @@ class MailTemplateService {
$emailView->setTemplatePathAndFilename( $emailView->setTemplatePathAndFilename(
$templateEntry['templatePath'] . $this->language . '.sg_mail.locallang.html' $templateEntry['templatePath'] . $this->language . '.sg_mail.locallang.html'
); );
$emailView->assignMultiple($this->content); $emailView->assignMultiple($this->markers);
$emailBody = $emailView->render(); $emailBody = $emailView->render();
if ($this->ignoreMailQueue) { if ($this->ignoreMailQueue) {
...@@ -287,11 +281,11 @@ class MailTemplateService { ...@@ -287,11 +281,11 @@ class MailTemplateService {
} }
/** /**
* @param array $content * @param array $markers
* @return MailTemplateService * @return MailTemplateService
*/ */
public function setContent(array $content) { public function setMarkers(array $markers) {
$this->content = $content; $this->markers = $markers;
return $this; return $this;
} }
} }
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