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

[TASK] Add Mailservice function to get the system languages

parent 3125a4fe
No related branches found
No related tags found
1 merge request!3New version 4 1
...@@ -33,10 +33,12 @@ use SGalinski\SgMail\Domain\Repository\MailRepository; ...@@ -33,10 +33,12 @@ use SGalinski\SgMail\Domain\Repository\MailRepository;
use SGalinski\SgMail\Domain\Repository\TemplateRepository; use SGalinski\SgMail\Domain\Repository\TemplateRepository;
use Swift_Attachment; use Swift_Attachment;
use Swift_OutputByteStream; use Swift_OutputByteStream;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Mail\MailMessage; use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
...@@ -714,4 +716,23 @@ class MailTemplateService { ...@@ -714,4 +716,23 @@ class MailTemplateService {
$this->pid = (int) $pid; $this->pid = (int) $pid;
return $this; return $this;
} }
/**
* Get all the active system languages in an array
*
* @return array
* @throws \InvalidArgumentException
*/
public static function getSystemLanguages() {
/** @var $databaseConnection DatabaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
/** @var QueryResultInterface $rows */
$rows = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_language',
'deleted = 0 AND hidden = 1'
);
return $rows->toArray();
}
} }
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