Commit 9aaf1728 authored by Paul Ilea's avatar Paul Ilea
Browse files

[TASK] Update default language set

CGL changes
parent d0cfe19c
......@@ -66,7 +66,7 @@ class MailTemplateService {
/**
* @var array $ccAddresses
*/
private $ccAddresses = [];
private $ccAddresses;
/**
* @var string $replyToAddress
......@@ -108,12 +108,12 @@ class MailTemplateService {
*
* @var array $tsSettings
*/
private $tsSettings = [];
private $tsSettings;
/**
* @var array $bccAddresses
*/
private $bccAddresses = [];
private $bccAddresses;
/**
* @var int
......@@ -147,6 +147,8 @@ class MailTemplateService {
/**
* MailTemplateService constructor.
*
* @throws \InvalidArgumentException
*/
public function __construct() {
/** @var ObjectManager objectManager */
......@@ -221,10 +223,11 @@ class MailTemplateService {
/**
* call in extlocalconf of an extension if you have a custom register class
*
* @param RegisterInterface
* @param boolean Should the object initialize itself ?
* @param RegisterInterface $fileNameWithNamespace
* @param boolean $initObject Should the object initialize itself ?
*
* @return bool
* @throws \InvalidArgumentException
*/
public static function registerByFile($fileNameWithNamespace, $initObject = TRUE) {
$registerObject = GeneralUtility::makeInstance($fileNameWithNamespace);
......@@ -331,7 +334,7 @@ class MailTemplateService {
$defaultTemplateContent = file_get_contents($templatePath . $this->language . '.template.html');
} else {
// no language found and no default template
$this->setLanguage('en');
$this->setLanguage($this->tsSettings['templateDefaultLanguage'] ?: 'en');
// does an english default template exist ?
if (file_exists($templatePath . $this->language . '.template.html')) {
$this->sendEmail();
......@@ -344,6 +347,7 @@ class MailTemplateService {
if ($isPreview) {
$previewMarker = [];
/** @var array $markerArray */
$markerArray = self::$registerArray[$this->extensionKey][$this->templateName]['marker'];
foreach ($markerArray as $marker) {
if ($marker['backend_translation_key']) {
......@@ -361,7 +365,7 @@ class MailTemplateService {
/** @var StandaloneView $emailView */
$emailView = $this->objectManager->get(StandaloneView::class);
if (!isset($defaultTemplateContent)) {
if (null === $defaultTemplateContent) {
$emailView->setTemplateSource($template->getContent());
$subject = $template->getSubject();
} else {
......@@ -412,6 +416,7 @@ class MailTemplateService {
* @param int $sendingTime
* @param int $priority
* @param bool $sent
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
private function addMailToMailQueue(
$extensionKey, $templateName, $subject, $emailBody, $priority, $sendingTime = 0, $sent = FALSE
......@@ -440,6 +445,8 @@ class MailTemplateService {
* Send a Mail from the queue, identified by its id
*
* @param int $uid
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
public function sendMailFromQueue($uid) {
$mailRepository = $this->objectManager->get(MailRepository::class);
......@@ -601,7 +608,7 @@ class MailTemplateService {
/**
* @param Swift_OutputByteStream $data
* @param string $path
* @param string $filename
* @param string $contentType
* @return MailTemplateService
*/
......
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