2 namespace TYPO3\CMS\Rtehtmlarea\Extension;
17 use SJBR\StaticInfoTables\Utility\LocalizationUtility;
41 protected $pluginButtons =
'lefttoright,righttoleft,language,showlanguagemarks';
49 'lefttoright' =>
'LeftToRight',
50 'righttoleft' =>
'RightToLeft',
51 'language' =>
'Language',
52 'showlanguagemarks' =>
'ShowLanguageMarks'
66 return parent::main($configuration);
78 if (!is_array($this->configuration[
'thisConfig'][
'buttons.']) || !is_array($this->configuration[
'thisConfig'][
'buttons.'][($button .
'.')])) {
79 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
' = new Object();';
83 'LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/Language/locallang.xlf:No language mark'
86 $languages = array_flip(array_merge($languages, $this->
getLanguages()));
87 $languagesJSArray = array();
88 foreach ($languages as $key => $value) {
89 $languagesJSArray[] = array(
'text' => $key,
'value' => $value);
91 $languagesJSArray = json_encode(array(
'options' => $languagesJSArray));
92 $jsArray[] =
'RTEarea[editornumber].buttons.' . $button .
'.dataUrl = "' . $this->
writeTemporaryFile($button .
'_' . $this->configuration[
'contentLanguageUid'],
'js', $languagesJSArray) .
'";';
93 return implode(LF, $jsArray);
107 $nameArray = array();
110 $table =
'static_languages';
111 $lang = LocalizationUtility::getCurrentLanguage();
112 $titleFields = LocalizationUtility::getLabelFields($table,
$lang);
113 $prefixedTitleFields = array();
114 foreach ($titleFields as $titleField) {
115 $prefixedTitleFields[] = $table .
'.' . $titleField;
117 $labelFields = implode(
',', $prefixedTitleFields);
119 if (is_array($this->configuration[
'thisConfig'][
'buttons.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'language.']) && isset($this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'restrictToItems'])) {
120 $languageList = implode(
'\',\
'',
GeneralUtility::trimExplode(
',', $databaseConnection->fullQuoteStr(strtoupper($this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'restrictToItems']), $table)));
121 $where .=
' AND ' . $table .
'.lg_iso_2 IN (' . $languageList .
')';
123 $res = $databaseConnection->exec_SELECTquery(
124 $table .
'.lg_iso_2,' . $table .
'.lg_country_iso_2,' . $labelFields,
128 $prefixLabelWithCode = (bool)$this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'prefixLabelWithCode'];
129 $postfixLabelWithCode = (bool)$this->configuration[
'thisConfig'][
'buttons.'][
'language.'][
'postfixLabelWithCode'];
130 while ($row = $databaseConnection->sql_fetch_assoc($res)) {
131 $code = strtolower($row[
'lg_iso_2']) . ($row[
'lg_country_iso_2'] ?
'-' . strtoupper($row[
'lg_country_iso_2']) :
'');
132 foreach ($titleFields as $titleField) {
133 if ($row[$titleField]) {
134 $nameArray[$code] = $prefixLabelWithCode ? $code .
' - ' . $row[$titleField] : ($postfixLabelWithCode ? $row[$titleField] .
' - ' . $code : $row[$titleField]);
139 $databaseConnection->sql_free_result($res);
140 uasort($nameArray,
'strcoll');
154 return array_diff($show, array(
'language'));