[!!!][TASK] Deprecate FormEngine::sL() 66/35466/11
authorFrank Nägler <typo3@naegler.net>
Mon, 15 Dec 2014 08:54:08 +0000 (09:54 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 15 Dec 2014 14:52:58 +0000 (15:52 +0100)
This patch deprecates FormEngine::sL() and removes
the dependency from all form element classes.

Resolves: #63855
Releases: master
Change-Id: I58a596c9c8c09f18f5129cd64dd1e76296d37f3f
Reviewed-on: http://review.typo3.org/35466
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/DataPreprocessor.php
typo3/sysext/backend/Classes/Form/Element/FlexElement.php
typo3/sysext/backend/Classes/Form/Element/GroupElement.php
typo3/sysext/backend/Classes/Form/Element/InlineElement.php
typo3/sysext/backend/Classes/Form/Element/SelectElement.php
typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php
typo3/sysext/backend/Classes/Form/Element/SuggestElement.php
typo3/sysext/backend/Classes/Form/Element/TreeElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-63855-FormEngine-sL.rst [new file with mode: 0644]

index c7f5cdf..d758ac2 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Class for getting and transforming data for display in backend forms (TCEforms)
@@ -378,6 +379,7 @@ class DataPreprocessor {
                $dataAcc = array();
                // For list selectors (multi-value):
                if ((int)$fieldConfig['config']['maxitems'] > 1 || $fieldConfig['config']['renderMode'] === 'tree') {
+                       $languageService = $this->getLanguageService();
                        // Add regular elements:
                        if (!is_array($fieldConfig['config']['items'])) {
                                $fieldConfig['config']['items'] = array();
@@ -386,7 +388,7 @@ class DataPreprocessor {
                        foreach ($fieldConfig['config']['items'] as $pvpv) {
                                foreach ($elements as $eKey => $value) {
                                        if ((string)$value === (string)$pvpv[1]) {
-                                               $dataAcc[$eKey] = rawurlencode($pvpv[1]) . '|' . rawurlencode($this->sL($pvpv[0]));
+                                               $dataAcc[$eKey] = rawurlencode($pvpv[1]) . '|' . rawurlencode($languageService->sL($pvpv[0]));
                                        }
                                }
                        }
@@ -605,6 +607,7 @@ class DataPreprocessor {
         * @see renderRecord_selectProc()
         */
        public function selectAddSpecial($dataAcc, $elements, $specialKey) {
+               $languageService = $this->getLanguageService();
                // Special select types:
                switch ((string)$specialKey) {
                        case 'tables':
@@ -612,7 +615,7 @@ class DataPreprocessor {
                                foreach ($tNames as $tableName) {
                                        foreach ($elements as $eKey => $value) {
                                                if ((string)$tableName === (string)$value) {
-                                                       $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($GLOBALS['TCA'][$value]['ctrl']['title']));
+                                                       $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($languageService->sL($GLOBALS['TCA'][$value]['ctrl']['title']));
                                                }
                                        }
                                }
@@ -623,7 +626,7 @@ class DataPreprocessor {
                                        foreach ($theTypes as $theTypesArrays) {
                                                foreach ($elements as $eKey => $value) {
                                                        if ((string)$theTypesArrays[1] === (string)$value) {
-                                                               $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($theTypesArrays[0]));
+                                                               $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($languageService->sL($theTypesArrays[0]));
                                                        }
                                                }
                                        }
@@ -674,7 +677,7 @@ class DataPreprocessor {
                                                        foreach ($coValue['items'] as $itemKey => $itemCfg) {
                                                                foreach ($elements as $eKey => $value) {
                                                                        if (($coKey . ':' . $itemKey) === (string)$value) {
-                                                                               $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($this->sL($itemCfg[0]));
+                                                                               $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($languageService->sL($itemCfg[0]));
                                                                        }
                                                                }
                                                        }
@@ -696,10 +699,10 @@ class DataPreprocessor {
                                                // Add label for main module:
                                                $pp = explode('_', $value);
                                                if (count($pp) > 1) {
-                                                       $label .= $GLOBALS['LANG']->moduleLabels['tabs'][($pp[0] . '_tab')] . '>';
+                                                       $label .= $languageService->moduleLabels['tabs'][($pp[0] . '_tab')] . '>';
                                                }
                                                // Add modules own label now:
-                                               $label .= $GLOBALS['LANG']->moduleLabels['tabs'][$value . '_tab'];
+                                               $label .= $languageService->moduleLabels['tabs'][$value . '_tab'];
                                                if ((string)$theModName === (string)$value) {
                                                        $dataAcc[$eKey] = rawurlencode($value) . '|' . rawurlencode($label);
                                                }
@@ -725,6 +728,7 @@ class DataPreprocessor {
         * @see renderRecord_selectProc()
         */
        public function selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row, $table) {
+               $languageService = $this->getLanguageService();
                // Init:
                $recordList = array();
                // Foreign_table
@@ -755,7 +759,7 @@ class DataPreprocessor {
                // After this we can traverse the loadDBgroup values and match values with the list of possible values in $recordList:
                foreach ($dataIds as $theId) {
                        if (isset($recordList[$theId])) {
-                               $lPrefix = $this->sL($fieldConfig['config'][($theId > 0 ? '' : 'neg_') . 'foreign_table_prefix']);
+                               $lPrefix = $languageService->sL($fieldConfig['config'][($theId > 0 ? '' : 'neg_') . 'foreign_table_prefix']);
                                if ($fieldConfig['config']['MM'] || $fieldConfig['config']['foreign_field']) {
                                        $dataAcc[] = rawurlencode($theId) . '|' . rawurlencode(GeneralUtility::fixed_lgd_cs(($lPrefix . strip_tags($recordList[$theId])), $GLOBALS['BE_USER']->uc['titleLen']));
                                } else {
@@ -895,12 +899,14 @@ class DataPreprocessor {
        /**
         * Local wrapper function for LANG->sL (returning language labels)
         *
-        * @param string Language label key
+        * @param string $in Language label key
         * @return string Localized label value.
         * @access private
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function sL($in) {
-               return $GLOBALS['LANG']->sL($in);
+               GeneralUtility::logDeprecatedFunction();
+               return $this->getLanguageService()->sL($in);
        }
 
        /**
@@ -919,4 +925,10 @@ class DataPreprocessor {
                return $liveDefaultId;
        }
 
+       /**
+        * @return LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index f81a00c..be5a089 100644 (file)
@@ -44,13 +44,14 @@ class FlexElement extends AbstractFormElement {
                }
                // Get data structure:
                if (is_array($dataStructArray)) {
+                       $languageService = $this->getLanguageService();
                        // Get data:
                        $xmlData = $additionalInformation['itemFormElValue'];
                        $xmlHeaderAttributes = GeneralUtility::xmlGetHeaderAttribs($xmlData);
                        $storeInCharset = strtolower($xmlHeaderAttributes['encoding']);
                        if ($storeInCharset) {
-                               $currentCharset = $this->getLanguageService()->charSet;
-                               $xmlData = $this->getLanguageService()->csConvObj->conv($xmlData, $storeInCharset, $currentCharset, 1);
+                               $currentCharset = $languageService->charSet;
+                               $xmlData = $languageService->csConvObj->conv($xmlData, $storeInCharset, $currentCharset, 1);
                        }
                        $editData = GeneralUtility::xml2array($xmlData);
                        // Must be XML parsing error...
@@ -184,9 +185,9 @@ class FlexElement extends AbstractFormElement {
                                        }
                                        // Add to tab:
                                        $tabParts[] = array(
-                                               'label' => $dataStruct['ROOT']['TCEforms']['sheetTitle'] ? $this->formEngine->sL($dataStruct['ROOT']['TCEforms']['sheetTitle']) : $sheet,
-                                               'description' => $dataStruct['ROOT']['TCEforms']['sheetDescription'] ? $this->formEngine->sL($dataStruct['ROOT']['TCEforms']['sheetDescription']) : '',
-                                               'linkTitle' => $dataStruct['ROOT']['TCEforms']['sheetShortDescr'] ? $this->formEngine->sL($dataStruct['ROOT']['TCEforms']['sheetShortDescr']) : '',
+                                               'label' => $dataStruct['ROOT']['TCEforms']['sheetTitle'] ? $languageService->sL($dataStruct['ROOT']['TCEforms']['sheetTitle']) : $sheet,
+                                               'description' => $dataStruct['ROOT']['TCEforms']['sheetDescription'] ? $languageService->sL($dataStruct['ROOT']['TCEforms']['sheetDescription']) : '',
+                                               'linkTitle' => $dataStruct['ROOT']['TCEforms']['sheetShortDescr'] ? $languageService->sL($dataStruct['ROOT']['TCEforms']['sheetShortDescr']) : '',
                                                'content' => $sheetContent
                                        );
                                }
@@ -223,6 +224,7 @@ class FlexElement extends AbstractFormElement {
                $mayRestructureFlexforms = $this->getBackendUserAuthentication()->checkLanguageAccess(0);
                // Data Structure array must be ... and array of course...
                if (is_array($dataStruct)) {
+                       $languageService = $this->getLanguageService();
                        foreach ($dataStruct as $key => $value) {
                                // Traversing fields in structure:
                                if (is_array($value)) {
@@ -236,7 +238,7 @@ class FlexElement extends AbstractFormElement {
 
                                        // If there is a title, check for LLL label
                                        if (strlen($theTitle) > 0) {
-                                               $theTitle = htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->formEngine->sL($theTitle),
+                                               $theTitle = htmlspecialchars(GeneralUtility::fixed_lgd_cs($languageService->sL($theTitle),
                                                        (int)$this->getBackendUserAuthentication()->uc['titleLen']));
                                        }
                                        // If it's a "section" or "container":
@@ -312,7 +314,7 @@ class FlexElement extends AbstractFormElement {
                                                                $this->formEngine->additionalJS_submit = $additionalJS_submit_saved;
                                                                $title = '';
                                                                if (isset($nCfg['title'])) {
-                                                                       $title = $this->formEngine->sL($nCfg['title']);
+                                                                       $title = $languageService->sL($nCfg['title']);
                                                                }
                                                                $newElementsLinks[] = '<a href="#" onclick="' . htmlspecialchars($onClickInsert) . '">'
                                                                        . IconUtility::getSpriteIcon('actions-document-new')
@@ -323,7 +325,7 @@ class FlexElement extends AbstractFormElement {
                                                        // Adding the sections
 
                                                        // add the "toggle all" button for the sections
-                                                       $toggleAll = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.toggleall', TRUE);
+                                                       $toggleAll = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.toggleall', TRUE);
                                                        $output .= '
                                                        <div class="t3-form-field-toggle-flexsection t3-form-flexsection-toggle">
                                                                <a href="#">'. IconUtility::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . '</a>
@@ -333,7 +335,7 @@ class FlexElement extends AbstractFormElement {
                                                        // add the "new" link
                                                        if ($mayRestructureFlexforms) {
                                                                $output .= '<div class="t3-form-field-add-flexsection"><strong>'
-                                                                               . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.addnew', TRUE)
+                                                                               . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.addnew', TRUE)
                                                                                . ':</strong> ' . implode(' | ', $newElementsLinks) . '</div>';
                                                        }
 
@@ -425,7 +427,7 @@ class FlexElement extends AbstractFormElement {
                                                        if ($displayConditionResult) {
                                                                $fakePA = array();
                                                                $fakePA['fieldConf'] = array(
-                                                                       'label' => $this->formEngine->sL(trim($value['TCEforms']['label'])),
+                                                                       'label' => $languageService->sL(trim($value['TCEforms']['label'])),
                                                                        'config' => $value['TCEforms']['config'],
                                                                        'defaultExtras' => $value['TCEforms']['defaultExtras'],
                                                                        'onChange' => $value['TCEforms']['onChange']
index bd632f1..ec399a8 100644 (file)
@@ -225,8 +225,9 @@ class GroupElement extends AbstractFormElement {
                                // Creating string showing allowed types:
                                $tempFT = GeneralUtility::trimExplode(',', $allowed, TRUE);
                                $onlySingleTableAllowed = FALSE;
+                               $languageService = $this->getLanguageService();
                                if (trim($tempFT[0]) === '*') {
-                                       $info .= '<span class="nobr">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables')) . '</span><br />';
+                                       $info .= '<span class="nobr">' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables')) . '</span><br />';
                                } elseif ($tempFT) {
                                        $onlySingleTableAllowed = count($tempFT) == 1;
                                        foreach ($tempFT as $theT) {
@@ -234,7 +235,7 @@ class GroupElement extends AbstractFormElement {
                                                $info .= '<span class="nobr">
                                                                        <a href="#" onclick="' . htmlspecialchars($aOnClick) . '">'
                                                        . IconUtility::getSpriteIconForRecord($theT, array())
-                                                       . htmlspecialchars($this->formEngine->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . '</a></span><br />';
+                                                       . htmlspecialchars($languageService->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . '</a></span><br />';
                                        }
                                }
                                $perms_clause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
index 352e2a0..8f3762c 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * The Inline-Relational-Record-Editing (IRRE) functions as part of the TCEforms.
@@ -627,6 +628,7 @@ class InlineElement {
         * @return string The HTML code with the control-icons
         */
        public function renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config = array(), $isVirtualRecord = FALSE) {
+               $languageService = $this->getLanguageService();
                // Initialize:
                $cells = array();
                $isNewItem = substr($rec['uid'], 0, 3) == 'NEW';
@@ -655,9 +657,9 @@ class InlineElement {
                // Icon to visualize that a required field is nested in this inline level:
                $cells['required'] = '<img name="' . $nameObjectFtId . '_req" src="clear.gif" width="10" height="10" hspace="4" vspace="3" alt="" />';
                if (isset($rec['__create'])) {
-                       $cells['localize.isLocalizable'] = IconUtility::getSpriteIcon('actions-edit-localize-status-low', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:localize.isLocalizable', TRUE)));
+                       $cells['localize.isLocalizable'] = IconUtility::getSpriteIcon('actions-edit-localize-status-low', array('title' => $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:localize.isLocalizable', TRUE)));
                } elseif (isset($rec['__remove'])) {
-                       $cells['localize.wasRemovedInOriginal'] = IconUtility::getSpriteIcon('actions-edit-localize-status-high', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:localize.wasRemovedInOriginal', TRUE)));
+                       $cells['localize.wasRemovedInOriginal'] = IconUtility::getSpriteIcon('actions-edit-localize-status-high', array('title' => $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:localize.wasRemovedInOriginal', TRUE)));
                }
                // "Info": (All records)
                if ($enabledControls['info'] && !$isNewItem) {
@@ -668,7 +670,7 @@ class InlineElement {
                                $uid = $rec['uid'];
                                $table = $foreign_table;
                        }
-                       $cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . $uid . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';
+                       $cells['info'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . $uid . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('status-dialog-information', array('title' => $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE))) . '</a>';
                }
                // If the table is NOT a read-only table, then show these links:
                if (!$tcaTableCtrl['readOnly'] && !$isVirtualRecord) {
@@ -681,7 +683,7 @@ class InlineElement {
                                                $style = ' style="' . $config['inline']['inlineNewButtonStyle'] . '"';
                                        }
                                        $cells['new'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $class . $style . '>' . IconUtility::getSpriteIcon(('actions-' . ($isPagesTable ? 'page' : 'document') . '-new'), array(
-                                               'title' => $GLOBALS['LANG']->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')), TRUE)
+                                               'title' => $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')), TRUE)
                                        )) . '</a>';
                                }
                        }
@@ -690,16 +692,16 @@ class InlineElement {
                                $onClick = 'return inline.changeSorting(\'' . $nameObjectFtId . '\', \'1\')';
                                // Up
                                $style = $config['inline']['first'] == $rec['uid'] ? 'style="visibility: hidden;"' : '';
-                               $cells['sort.up'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" class="sortingUp" ' . $style . '>' . IconUtility::getSpriteIcon('actions-move-up', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:moveUp', TRUE))) . '</a>';
+                               $cells['sort.up'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" class="sortingUp" ' . $style . '>' . IconUtility::getSpriteIcon('actions-move-up', array('title' => $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:moveUp', TRUE))) . '</a>';
                                $onClick = 'return inline.changeSorting(\'' . $nameObjectFtId . '\', \'-1\')';
                                // Down
                                $style = $config['inline']['last'] == $rec['uid'] ? 'style="visibility: hidden;"' : '';
-                               $cells['sort.down'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" class="sortingDown" ' . $style . '>' . IconUtility::getSpriteIcon('actions-move-down', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:moveDown', TRUE))) . '</a>';
+                               $cells['sort.down'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" class="sortingDown" ' . $style . '>' . IconUtility::getSpriteIcon('actions-move-down', array('title' => $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:moveDown', TRUE))) . '</a>';
                        }
                        // "Delete" link:
                        if ($enabledControls['delete'] && ($isPagesTable && $localCalcPerms & 4 || !$isPagesTable && $calcPerms & 16)) {
                                $onClick = 'inline.deleteRecord(\'' . $nameObjectFtId . '\');';
-                               $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars(('if (confirm(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL('deleteWarning')) . ')) {  ' . $onClick . ' } return false;')) . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete', TRUE))) . '</a>';
+                               $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars(('if (confirm(' . GeneralUtility::quoteJSvalue($languageService->getLL('deleteWarning')) . ')) {  ' . $onClick . ' } return false;')) . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete', TRUE))) . '</a>';
                        }
 
                        // "Hide/Unhide" links:
@@ -708,24 +710,24 @@ class InlineElement {
                                $onClick = 'return inline.enableDisableRecord(\'' . $nameObjectFtId . '\')';
                                if ($rec[$hiddenField]) {
                                        $cells['hide.unhide'] = '<a href="#" class="hiddenHandle" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide', array(
-                                               'title' => $GLOBALS['LANG']->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE),
+                                               'title' => $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE),
                                                'id' => ($nameObjectFtId . '_disabled')
                                        )) . '</a>';
                                } else {
                                        $cells['hide.hide'] = '<a href="#" class="hiddenHandle" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-edit-hide', array(
-                                               'title' => $GLOBALS['LANG']->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE),
+                                               'title' => $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE),
                                                'id' => ($nameObjectFtId . '_disabled')
                                        )) . '</a>';
                                }
                        }
                        // Drag&Drop Sorting: Sortable handler for script.aculo.us
                        if ($enabledControls['dragdrop'] && $permsEdit && $enableManualSorting && $config['appearance']['useSortable']) {
-                               $cells['dragdrop'] = IconUtility::getSpriteIcon('actions-move-move', array('data-id' => $rec['uid'], 'class' => 'sortableHandle', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.move', TRUE)));
+                               $cells['dragdrop'] = IconUtility::getSpriteIcon('actions-move-move', array('data-id' => $rec['uid'], 'class' => 'sortableHandle', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move', TRUE)));
                        }
                } elseif ($isVirtualRecord && $isParentExisting) {
                        if ($enabledControls['localize'] && isset($rec['__create'])) {
                                $onClick = 'inline.synchronizeLocalizeRecords(\'' . $nameObjectFt . '\', ' . $rec['uid'] . ');';
-                               $cells['localize'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-document-localize', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:localize', TRUE))) . '</a>';
+                               $cells['localize'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-document-localize', array('title' => $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:localize', TRUE))) . '</a>';
                        }
                }
                // If the record is edit-locked by another user, we will show a little warning sign:
@@ -763,7 +765,7 @@ class InlineElement {
                                $comboRecord = $this->getNewRecord($this->inlineFirstPid, $comboConfig['foreign_table']);
                                $isNewRecord = TRUE;
                        }
-                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.inline_use_combination'), '', FlashMessage::WARNING);
+                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.inline_use_combination'), '', FlashMessage::WARNING);
                        $out = $flashMessage->render();
                        // Get the TCEforms interpretation of the TCA of the child table
                        $out .= $this->renderMainFields($comboConfig['foreign_table'], $comboRecord);
@@ -852,9 +854,9 @@ class InlineElement {
                        // there is only one record item in the select-box, that is selected by default
                        // The selector-box creates a new relation on using a onChange event (see some line above)
                        if (!empty($conf['appearance']['createNewRelationLinkTitle'])) {
-                               $createNewRelationText = $GLOBALS['LANG']->sL($conf['appearance']['createNewRelationLinkTitle'], TRUE);
+                               $createNewRelationText = $this->getLanguageService()->sL($conf['appearance']['createNewRelationLinkTitle'], TRUE);
                        } else {
-                               $createNewRelationText = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', TRUE);
+                               $createNewRelationText = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', TRUE);
                        }
                        $item .= ' <a href="#" class="t3-button" onclick="' . htmlspecialchars($onChange) . '" align="abstop">' . IconUtility::getSpriteIcon('actions-document-new', array('title' => $createNewRelationText)) . $createNewRelationText . '</a>';
                        $item = '<div class="t3-form-field-group">' . $item . '</div>';
@@ -879,9 +881,9 @@ class InlineElement {
                $mode = 'db';
                $showUpload = FALSE;
                if (!empty($config['appearance']['createNewRelationLinkTitle'])) {
-                       $createNewRelationText = $GLOBALS['LANG']->sL($config['appearance']['createNewRelationLinkTitle'], TRUE);
+                       $createNewRelationText = $this->getLanguageService()->sL($config['appearance']['createNewRelationLinkTitle'], TRUE);
                } else {
-                       $createNewRelationText = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', TRUE);
+                       $createNewRelationText = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', TRUE);
                }
                if (is_array($config['appearance'])) {
                        if (isset($config['appearance']['elementBrowserType'])) {
@@ -920,7 +922,7 @@ class InlineElement {
                                        data-target-folder="' . htmlspecialchars($folder->getCombinedIdentifier()) . '"
                                        data-max-file-size="' . htmlspecialchars($maxFileSize) . '"
                                        ><span class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-upload">&nbsp;</span>';
-                               $item .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.select-and-submit', TRUE);
+                               $item .= $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.select-and-submit', TRUE);
                                $item .= '</a>';
 
                                $this->loadDragUploadJs();
@@ -955,11 +957,12 @@ class InlineElement {
         * @return string The HTML code of the new link, wrapped in a div
         */
        protected function getLevelInteractionLink($type, $objectPrefix, $conf = array()) {
+               $languageService = $this->getLanguageService();
                $nameObject = $this->inlineNames['object'];
                $attributes = array();
                switch ($type) {
                        case 'newRecord':
-                               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.createnew', TRUE);
+                               $title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.createnew', TRUE);
                                $icon = 'actions-document-new';
                                $className = 'typo3-newRecordLink';
                                $attributes['class'] = 't3-button inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'];
@@ -969,22 +972,22 @@ class InlineElement {
                                }
                                if (!empty($conf['appearance']['newRecordLinkAddTitle'])) {
                                        $title = sprintf(
-                                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.createnew.link', TRUE),
-                                               $GLOBALS['LANG']->sL($GLOBALS['TCA'][$conf['foreign_table']]['ctrl']['title'], TRUE)
+                                               $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.createnew.link', TRUE),
+                                               $languageService->sL($GLOBALS['TCA'][$conf['foreign_table']]['ctrl']['title'], TRUE)
                                        );
                                } elseif (isset($conf['appearance']['newRecordLinkTitle']) && $conf['appearance']['newRecordLinkTitle'] !== '') {
-                                       $title = $GLOBALS['LANG']->sL($conf['appearance']['newRecordLinkTitle'], TRUE);
+                                       $title = $languageService->sL($conf['appearance']['newRecordLinkTitle'], TRUE);
                                }
                                break;
                        case 'localize':
-                               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:localizeAllRecords', 1);
+                               $title = $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:localizeAllRecords', 1);
                                $icon = 'actions-document-localize';
                                $className = 'typo3-localizationLink';
                                $attributes['class'] = 't3-button';
                                $attributes['onclick'] = 'return inline.synchronizeLocalizeRecords(\'' . $objectPrefix . '\', \'localize\')';
                                break;
                        case 'synchronize':
-                               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:synchronizeWithOriginalLanguage', TRUE);
+                               $title = $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:synchronizeWithOriginalLanguage', TRUE);
                                $icon = 'actions-document-synchronize';
                                $className = 'typo3-synchronizationLink';
                                $attributes['class'] = 't3-button inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'];
@@ -1095,7 +1098,7 @@ class InlineElement {
         * @return void
         */
        protected function processAjaxRequestConstruct(&$ajaxArguments) {
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_alt_doc.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_alt_doc.xlf');
                // Create a new anonymous object:
                $GLOBALS['SOBE'] = new \stdClass();
                $GLOBALS['SOBE']->MOD_MENU = array(
@@ -1663,7 +1666,7 @@ class InlineElement {
                                        unset($selItems[$tk]);
                                } else {
                                        if (isset($PA['fieldTSConfig']['altLabels.'][$p[1]])) {
-                                               $selItems[$tk][0] = htmlspecialchars($this->fObj->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]));
+                                               $selItems[$tk][0] = htmlspecialchars($this->getLanguageService()->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]));
                                        }
                                        if (isset($PA['fieldTSConfig']['altIcons.'][$p[1]])) {
                                                $selItems[$tk][2] = $PA['fieldTSConfig']['altIcons.'][$p[1]];
@@ -2554,7 +2557,7 @@ class InlineElement {
        protected function getJavaScriptAndStyleSheetsOfPageRenderer() {
                /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
                $pageRenderer = clone $GLOBALS['SOBE']->doc->getPageRenderer();
-               $pageRenderer->setCharSet($GLOBALS['LANG']->charSet);
+               $pageRenderer->setCharSet($this->getLanguageService()->charSet);
                $pageRenderer->setTemplateFile('EXT:backend/Resources/Private/Templates/helper_javascript_css.html');
                $javaScriptAndStyleSheets = $pageRenderer->render();
                return $javaScriptAndStyleSheets;
@@ -2600,4 +2603,11 @@ class InlineElement {
 
                return $flexFormParts;
        }
+
+       /**
+        * @return LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index ae574d0..fff6fcc 100644 (file)
@@ -78,7 +78,7 @@ class SelectElement extends AbstractFormElement {
 
                // Creating the label for the "No Matching Value" entry.
                $nMV_label = isset($additionalInformation['fieldTSConfig']['noMatchingValue_label'])
-                       ? $this->formEngine->sL($additionalInformation['fieldTSConfig']['noMatchingValue_label'])
+                       ? $this->getLanguageService()->sL($additionalInformation['fieldTSConfig']['noMatchingValue_label'])
                        : '[ ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue') . ' ]';
                // Prepare some values:
                $maxitems = (int)$config['maxitems'];
@@ -169,7 +169,7 @@ class SelectElement extends AbstractFormElement {
                                $tvP[1] = rawurlencode(@sprintf($nMV_label, $evalValue));
                        } else {
                                if (isset($PA['fieldTSConfig']['altLabels.'][$evalValue])) {
-                                       $tvP[1] = rawurlencode($this->formEngine->sL($PA['fieldTSConfig']['altLabels.'][$evalValue]));
+                                       $tvP[1] = rawurlencode($languageService->sL($PA['fieldTSConfig']['altLabels.'][$evalValue]));
                                }
                                if (isset($PA['fieldTSConfig']['altIcons.'][$evalValue])) {
                                        $tvP[2] = $PA['fieldTSConfig']['altIcons.'][$evalValue];
@@ -232,9 +232,9 @@ class SelectElement extends AbstractFormElement {
                        if (isset($config['multiSelectFilterItems']) && is_array($config['multiSelectFilterItems']) && count($config['multiSelectFilterItems']) > 1) {
                                $filterDropDownOptions = array();
                                foreach ($config['multiSelectFilterItems'] as $optionElement) {
-                                       $optionValue = $this->formEngine->sL(isset($optionElement[1]) && $optionElement[1] != '' ? $optionElement[1]
+                                       $optionValue = $languageService->sL(isset($optionElement[1]) && $optionElement[1] != '' ? $optionElement[1]
                                                : $optionElement[0]);
-                                       $filterDropDownOptions[] = '<option value="' . htmlspecialchars($this->formEngine->sL($optionElement[0])) . '">'
+                                       $filterDropDownOptions[] = '<option value="' . htmlspecialchars($languageService->sL($optionElement[0])) . '">'
                                                . htmlspecialchars($optionValue) . '</option>';
                                }
                                $filterSelectbox = '<select class="t3-form-multiselect-filter-dropdown form-control">
@@ -337,7 +337,7 @@ class SelectElement extends AbstractFormElement {
                        if (in_array($selectItem[1], $removeItems) || $languageDeny || $authModeDeny) {
                                unset($selectItems[$selectItemIndex]);
                        } elseif (isset($PA['fieldTSConfig']['altLabels.'][$selectItem[1]])) {
-                               $selectItems[$selectItemIndex][0] = htmlspecialchars($this->formEngine->sL($PA['fieldTSConfig']['altLabels.'][$selectItem[1]]));
+                               $selectItems[$selectItemIndex][0] = htmlspecialchars($this->getLanguageService()->sL($PA['fieldTSConfig']['altLabels.'][$selectItem[1]]));
                        }
 
                        // Removing doktypes with no access:
@@ -909,8 +909,4 @@ class SelectElement extends AbstractFormElement {
        public function isForceAlternativeFieldValueUse() {
                return $this->forceAlternativeFieldValueUse;
        }
-
-
-
-
 }
index bcb70b5..4ce4933 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Default implementation of a handler class for an ajax record selector.
@@ -167,7 +168,14 @@ class SuggestDefaultReceiver {
                                $uid = $row['t3ver_oid'] > 0 ? $row['t3ver_oid'] : $row['uid'];
                                $path = $this->getRecordPath($row, $uid);
                                if (strlen($path) > 30) {
-                                       $croppedPath = '<abbr title="' . htmlspecialchars($path) . '">' . htmlspecialchars(($GLOBALS['LANG']->csConvObj->crop($GLOBALS['LANG']->charSet, $path, 10) . '...' . $GLOBALS['LANG']->csConvObj->crop($GLOBALS['LANG']->charSet, $path, -20))) . '</abbr>';
+                                       $languageService = $this->getLanguageService();
+                                       $croppedPath = '<abbr title="' . htmlspecialchars($path) . '">' .
+                                               htmlspecialchars(
+                                                               $languageService->csConvObj->crop($languageService->charSet, $path, 10)
+                                                               . '...'
+                                                               . $languageService->csConvObj->crop($languageService->charSet, $path, -20)
+                                               ) .
+                                               '</abbr>';
                                } else {
                                        $croppedPath = htmlspecialchars($path);
                                }
@@ -389,4 +397,10 @@ class SuggestDefaultReceiver {
                return $entry;
        }
 
+       /**
+        * @return LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index 6b0e132..ab7ae89 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * TCEforms wizard for rendering an AJAX selector for records
@@ -62,6 +63,7 @@ class SuggestElement {
         * @return string The HTML code for the selector
         */
        public function renderSuggestSelector($fieldname, $table, $field, array $row, array $config) {
+               $languageService = $this->getLanguageService();
                $this->suggestCount++;
                $containerCssClass = $this->cssClass . ' ' . $this->cssClass . '-position-right';
                $suggestId = 'suggest-' . $table . '-' . $field . '-' . $row['uid'];
@@ -74,9 +76,9 @@ class SuggestElement {
                }
                $selector = '
                <div class="' . $containerCssClass . '" id="' . $suggestId . '">
-                       <input type="search" id="' . $fieldname . 'Suggest" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord') . '" class="' . $this->cssClass . '-search" />
+                       <input type="search" id="' . $fieldname . 'Suggest" value="' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord') . '" class="' . $this->cssClass . '-search" />
                        <div class="' . $this->cssClass . '-indicator" style="display: none;" id="' . $fieldname . 'SuggestIndicator">
-                               <img src="' . $GLOBALS['BACK_PATH'] . 'gfx/spinner.gif" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:alttext.suggestSearching') . '" />
+                               <img src="' . $GLOBALS['BACK_PATH'] . 'gfx/spinner.gif" alt="' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:alttext.suggestSearching') . '" />
                        </div>
                        <div class="' . $this->cssClass . '-choices" style="display: none;" id="' . $fieldname . 'SuggestChoices"></div>
 
@@ -110,7 +112,7 @@ class SuggestElement {
                $jsObj = str_replace(' ', '', ucwords(str_replace(array('-', '.'), ' ', GeneralUtility::strtolower($suggestId))));
                $this->TCEformsObj->additionalJS_post[] = '
                        var ' . $jsObj . ' = new TCEForms.Suggest("' . $fieldname . '", "' . $table . '", "' . $field . '", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ', "' . $type . '", ' . GeneralUtility::quoteJSvalue($jsRow) . ');' . LF
-                               . $jsObj . '.defaultValue = "' . GeneralUtility::slashJS($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord')) . '";' . LF;
+                               . $jsObj . '.defaultValue = "' . GeneralUtility::slashJS($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord')) . '";' . LF;
                return $selector;
        }
 
@@ -306,10 +308,16 @@ class SuggestElement {
                if (count($listItems) > 0) {
                        $list = implode('', $listItems);
                } else {
-                       $list = '<li class="suggest-noresults"><i>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.noRecordFound') . '</i></li>';
+                       $list = '<li class="suggest-noresults"><i>' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noRecordFound') . '</i></li>';
                }
                $list = '<ul class="' . $this->cssClass . '-resultlist">' . $list . '</ul>';
                $ajaxObj->addContent(0, $list);
        }
 
+       /**
+        * @return LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index abb3be5..ec4403d 100644 (file)
@@ -69,7 +69,7 @@ class TreeElement extends AbstractFormElement {
                                if ($additionalItem[1] !== '--div--') {
                                        $item = new \stdClass();
                                        $item->uid = $additionalItem[1];
-                                       $item->text = $GLOBALS['LANG']->sL($additionalItem[0]);
+                                       $item->text = $this->getLanguageService()->sL($additionalItem[0]);
                                        $item->selectable = TRUE;
                                        $item->leaf = TRUE;
                                        $item->checked = in_array($additionalItem[1], $selectedNodes);
index 82ce4bc..5ac97cc 100644 (file)
@@ -784,7 +784,7 @@ class FormEngine {
                if ($GLOBALS['TCA'][$table]) {
                        // Load the description content for the table.
                        if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) {
-                               $this->getLanguageService()->loadSingleTableDescription($table);
+                               $languageService->loadSingleTableDescription($table);
                        }
                        // Get the current "type" value for the record.
                        $typeNum = $this->getRTypeNum($table, $row);
@@ -847,13 +847,13 @@ class FormEngine {
                                                                                // Remember on which sheet we're currently working:
                                                                                $this->pushToDynNestedStack('tab', $tabIdentStringMD5 . '-' . ($out_sheet + 1));
                                                                                $out_array[$out_sheet] = array();
-                                                                               $out_array_meta[$out_sheet]['title'] = $this->sL($fieldLabel);
+                                                                               $out_array_meta[$out_sheet]['title'] = $languageService->sL($fieldLabel);
                                                                                // Register newline for Tab
                                                                                $out_array_meta[$out_sheet]['newline'] = $additionalPalette == 'newline';
                                                                        }
                                                                } else {
                                                                        // Setting alternative title for "General" tab if "--div--" is the very first element.
-                                                                       $out_array_meta[$out_sheet]['title'] = $this->sL($fieldLabel);
+                                                                       $out_array_meta[$out_sheet]['title'] = $languageService->sL($fieldLabel);
                                                                        // Only add the first tab to the dynNestedStack if there are more tabs:
                                                                        if ($tabIdentString && strpos($itemList, '--div--', strlen($fieldInfo))) {
                                                                                $this->pushToDynNestedStack('tab', $tabIdentStringMD5 . '-1');
@@ -863,9 +863,9 @@ class FormEngine {
                                                                if ($additionalPalette && !isset($this->palettesRendered[$this->renderDepth][$table][$additionalPalette])) {
                                                                        // Render a 'header' if not collapsed
                                                                        if ($GLOBALS['TCA'][$table]['palettes'][$additionalPalette]['canNotCollapse'] && $fieldLabel) {
-                                                                               $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $additionalPalette, $this->sL($fieldLabel));
+                                                                               $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $additionalPalette, $languageService->sL($fieldLabel));
                                                                        } else {
-                                                                               $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $additionalPalette, '', '', $this->sL($fieldLabel));
+                                                                               $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $additionalPalette, '', '', $languageService->sL($fieldLabel));
                                                                        }
                                                                        $this->palettesRendered[$this->renderDepth][$table][$additionalPalette] = 1;
                                                                }
@@ -1125,6 +1125,7 @@ class FormEngine {
                                if (in_array($field, $this->hiddenFieldListArr)) {
                                        $this->hiddenFieldAccum[] = '<input type="hidden" name="' . $PA['itemFormElName'] . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />';
                                } else {
+                                       $languageService = $this->getLanguageService();
                                        // Render as a normal field:
                                        // If the field is NOT a palette field, then we might create an icon which links to a palette for the field, if one exists.
                                        $palJSfunc = '';
@@ -1135,7 +1136,7 @@ class FormEngine {
                                                        list($thePalIcon, $palJSfunc) = $this->wrapOpenPalette(
                                                                IconUtility::getSpriteIcon(
                                                                        'actions-system-options-view',
-                                                                       array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.moreOptions')))
+                                                                       array('title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.moreOptions')))
                                                                ),
                                                                $table,
                                                                $row,
@@ -1148,8 +1149,8 @@ class FormEngine {
                                        $PA['onFocus'] = $palJSfunc && !$this->getBackendUserAuthentication()->uc['dontShowPalettesOnFocusInAB'] ? ' onfocus="' . htmlspecialchars($palJSfunc) . '"' : '';
                                        $PA['label'] = $PA['altName'] ?: $PA['fieldConf']['label'];
                                        $PA['label'] = $PA['fieldTSConfig']['label'] ?: $PA['label'];
-                                       $PA['label'] = $PA['fieldTSConfig']['label.'][$this->getLanguageService()->lang] ?: $PA['label'];
-                                       $PA['label'] = $this->sL($PA['label']);
+                                       $PA['label'] = $PA['fieldTSConfig']['label.'][$languageService->lang] ?: $PA['label'];
+                                       $PA['label'] = $languageService->sL($PA['label']);
                                        // JavaScript code for event handlers:
                                        $PA['fieldChangeFunc'] = array();
                                        $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = 'TBE_EDITOR.fieldChanged(\'' . $table . '\',\'' . $row['uid'] . '\',\'' . $field . '\',\'' . $PA['itemFormElName'] . '\');';
@@ -1195,7 +1196,7 @@ class FormEngine {
                                                        '<input type="hidden" name="' . htmlspecialchars($PA['itemFormElNameActive']) . '" value="0" />' .
                                                        '<input type="checkbox" name="' . htmlspecialchars($PA['itemFormElNameActive']) . '" value="1" id="tce-forms-textfield-use-override-' . $field . '-' . $row['uid'] . '" onchange="' . htmlspecialchars($onChange) . '"' . $checked . ' />' .
                                                        '<label for="tce-forms-textfield-use-override-' . $field . '-' . $row['uid'] . '">' .
-                                                       sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.placeholder.override'),
+                                                       sprintf($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.placeholder.override'),
                                                        BackendUtility::getRecordTitlePrep($placeholder, 20)) . '</label>' .
                                                '</span>'
                                                . '<div class="t3-form-placeholder-placeholder">' . $this->getSingleField_typeNone_render(
@@ -1575,7 +1576,7 @@ class FormEngine {
                        $tCells[] = '<td width="' . $pct . '%" style="'
                                . ($sKey == $sheetKey ? 'background-color: #9999cc; font-weight: bold;' : 'background-color: #aaaaaa;')
                                . ' cursor: hand;" onclick="' . htmlspecialchars($onClick) . '" align="center">'
-                               . ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey)
+                               . ($sheetCfg['ROOT']['TCEforms']['sheetTitle'] ? $this->getLanguageService()->sL($sheetCfg['ROOT']['TCEforms']['sheetTitle']) : $sKey)
                                . '</td>';
                }
                return '<table border="0" cellpadding="0" cellspacing="2" class="typo3-TCEforms-flexForm-sheetMenu"><tr>' . implode('', $tCells) . '</tr></table>';
@@ -2180,7 +2181,7 @@ class FormEngine {
                                                BackendUtility::getProcessedValue($table, $field, $dLVal['new'][$field], 0, 1)
                                        );
                                        $item .= '<div class="t3-form-original-language-diff">
-                                               <div class="t3-form-original-language-diffheader">' . htmlspecialchars($this->getLanguageService()>sL('LLL:EXT:lang/locallang_core.xlf:labels.changeInOrig')) . '</div>
+                                               <div class="t3-form-original-language-diffheader">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.changeInOrig')) . '</div>
                                                <div class="t3-form-original-language-diffcontent">' . $diffres . '</div>
                                        </div>';
                                }
@@ -2575,7 +2576,7 @@ class FormEngine {
                                        || is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) && ($RTE || !$wConf['RTEonly'])
                                ) {
                                        // Title / icon:
-                                       $iTitle = htmlspecialchars($this->sL($wConf['title']));
+                                       $iTitle = htmlspecialchars($this->getLanguageService()->sL($wConf['title']));
                                        if ($wConf['icon']) {
                                                $icon = $this->getIconHtml($wConf['icon'], $iTitle, $iTitle);
                                        } else {
@@ -3122,10 +3123,11 @@ class FormEngine {
         * @return array An array of arrays with three elements; label, value, icon
         */
        public function initItemArray($fieldValue) {
+               $languageService = $this->getLanguageService();
                $items = array();
                if (is_array($fieldValue['config']['items'])) {
                        foreach ($fieldValue['config']['items'] as $itemValue) {
-                               $items[] = array($this->sL($itemValue[0]), $itemValue[1], $itemValue[2]);
+                               $items[] = array($languageService->sL($itemValue[0]), $itemValue[1], $itemValue[2]);
                        }
                }
                return $items;
@@ -3142,6 +3144,7 @@ class FormEngine {
         * @return array The updated $item array
         */
        public function addItems($items, $iArray) {
+               $languageService = $this->getLanguageService();
                if (is_array($iArray)) {
                        foreach ($iArray as $value => $label) {
                                // if the label is an array (that means it is a subelement
@@ -3155,7 +3158,7 @@ class FormEngine {
                                } else {
                                        $icon = '';
                                }
-                               $items[] = array($this->sL($label), $value, $icon);
+                               $items[] = array($languageService->sL($label), $value, $icon);
                        }
                }
                return $items;
@@ -3173,6 +3176,7 @@ class FormEngine {
         * @return array The modified $items array
         */
        public function procItems($items, $iArray, $config, $table, $row, $field) {
+               $languageService = $this->getLanguageService();
                $params = array();
                $params['items'] = &$items;
                $params['config'] = $config;
@@ -3187,10 +3191,10 @@ class FormEngine {
                } catch (\Exception $exception) {
                        $fieldLabel = $field;
                        if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) {
-                               $fieldLabel = $this->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']);
+                               $fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']);
                        }
                        $message = sprintf(
-                               $this->sL('LLL:EXT:lang/locallang_core.xlf:error.items_proc_func_error'),
+                               $languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.items_proc_func_error'),
                                $fieldLabel,
                                $exception->getMessage()
                        );
@@ -3255,7 +3259,7 @@ class FormEngine {
                }
                // If 'special' is configured:
                if ($fieldValue['config']['special']) {
-                       $lang = $this->getLanguageService();
+                       $languageService = $this->getLanguageService();
                        switch ($fieldValue['config']['special']) {
                                case 'tables':
                                        $temp_tc = array_keys($GLOBALS['TCA']);
@@ -3265,14 +3269,14 @@ class FormEngine {
                                                        $icon = IconUtility::mapRecordTypeToSpriteIconName($theTableNames, array());
                                                        // Add help text
                                                        $helpText = array();
-                                                       $lang->loadSingleTableDescription($theTableNames);
+                                                       $languageService->loadSingleTableDescription($theTableNames);
                                                        $helpTextArray = $GLOBALS['TCA_DESCR'][$theTableNames]['columns'][''];
                                                        if (!empty($helpTextArray['description'])) {
                                                                $helpText['description'] = $helpTextArray['description'];
                                                        }
                                                        // Item configuration:
                                                        $items[] = array(
-                                                               $this->sL($GLOBALS['TCA'][$theTableNames]['ctrl']['title']),
+                                                               $languageService->sL($GLOBALS['TCA'][$theTableNames]['ctrl']['title']),
                                                                $theTableNames,
                                                                $icon,
                                                                $helpText
@@ -3290,7 +3294,7 @@ class FormEngine {
                                                }
                                                // Item configuration:
                                                $items[] = array(
-                                                       $this->sL($theTypeArrays[0]),
+                                                       $languageService->sL($theTypeArrays[0]),
                                                        $theTypeArrays[1],
                                                        $icon
                                                );
@@ -3307,21 +3311,21 @@ class FormEngine {
                                                if (!array_key_exists($theTable, $items)) {
                                                        $icon = IconUtility::mapRecordTypeToSpriteIconName($theTable, array());
                                                        $items[$theTable] = array(
-                                                               $this->sL($GLOBALS['TCA'][$theTable]['ctrl']['title']),
+                                                               $languageService->sL($GLOBALS['TCA'][$theTable]['ctrl']['title']),
                                                                '--div--',
                                                                $icon
                                                        );
                                                }
                                                // Add help text
                                                $helpText = array();
-                                               $lang->loadSingleTableDescription($theTable);
+                                               $languageService->loadSingleTableDescription($theTable);
                                                $helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theFullField];
                                                if (!empty($helpTextArray['description'])) {
                                                        $helpText['description'] = $helpTextArray['description'];
                                                }
                                                // Item configuration:
                                                $items[] = array(
-                                                       rtrim($lang->sl($GLOBALS['TCA'][$theTable]['columns'][$theField]['label']), ':') . ' (' . $theField . ')',
+                                                       rtrim($languageService->sL($GLOBALS['TCA'][$theTable]['columns'][$theField]['label']), ':') . ' (' . $theField . ')',
                                                        $theTypeArrays[1],
                                                        'empty-empty',
                                                        $helpText
@@ -3366,7 +3370,7 @@ class FormEngine {
                                                        if (is_array($coValue['items'])) {
                                                                // Add header:
                                                                $items[] = array(
-                                                                       $lang->sl($coValue['header']),
+                                                                       $languageService->sL($coValue['header']),
                                                                        '--div--'
                                                                );
                                                                // Traverse items:
@@ -3380,11 +3384,11 @@ class FormEngine {
                                                                        // Add help text
                                                                        $helpText = array();
                                                                        if (!empty($itemCfg[2])) {
-                                                                               $helpText['description'] = $lang->sl($itemCfg[2]);
+                                                                               $helpText['description'] = $languageService->sL($itemCfg[2]);
                                                                        }
                                                                        // Add item to be selected:
                                                                        $items[] = array(
-                                                                               $lang->sl($itemCfg[0]),
+                                                                               $languageService->sL($itemCfg[0]),
                                                                                $coKey . ':' . preg_replace('/[:|,]/', '', $itemKey),
                                                                                $icon,
                                                                                $helpText
@@ -3403,14 +3407,14 @@ class FormEngine {
                                        if (is_array($modList)) {
                                                foreach ($modList as $theMod) {
                                                        // Icon:
-                                                       $icon = $lang->moduleLabels['tabs_images'][$theMod . '_tab'];
+                                                       $icon = $languageService->moduleLabels['tabs_images'][$theMod . '_tab'];
                                                        if ($icon) {
                                                                $icon = '../' . PathUtility::stripPathSitePrefix($icon);
                                                        }
                                                        // Add help text
                                                        $helpText = array(
-                                                               'title' => $lang->moduleLabels['labels'][$theMod . '_tablabel'],
-                                                               'description' => $lang->moduleLabels['labels'][$theMod . '_tabdescr']
+                                                               'title' => $languageService->moduleLabels['labels'][$theMod . '_tablabel'],
+                                                               'description' => $languageService->moduleLabels['labels'][$theMod . '_tabdescr']
                                                        );
                                                        // Item configuration:
                                                        $items[] = array(
@@ -3460,6 +3464,7 @@ class FormEngine {
         * @see addSelectOptionsToItemArray(), BackendUtility::exec_foreign_table_where_query()
         */
        public function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = FALSE) {
+               $languageService = $this->getLanguageService();
                // Init:
                $pF = $pFFlag ? 'neg_' : '';
                $f_table = $fieldValue['config'][$pF . 'foreign_table'];
@@ -3471,8 +3476,8 @@ class FormEngine {
                if ($db->sql_error()) {
                        $msg = htmlspecialchars($db->sql_error());
                        $msg .= '<br />' . LF;
-                       $msg .= $this->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch');
-                       $msgTitle = $this->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch_title');
+                       $msg .= $languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch');
+                       $msgTitle = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch_title');
                        /** @var $flashMessage FlashMessage */
                        $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $msg, $msgTitle, FlashMessage::ERROR, TRUE);
                        /** @var $flashMessageService FlashMessageService */
@@ -3483,7 +3488,7 @@ class FormEngine {
                        return array();
                }
                // Get label prefix.
-               $lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
+               $lPrefix = $languageService->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
                // Get icon field + path if any:
                $iField = $GLOBALS['TCA'][$f_table]['ctrl']['selicon_field'];
                $iPath = trim($GLOBALS['TCA'][$f_table]['ctrl']['selicon_field_path']);
@@ -3604,23 +3609,23 @@ class FormEngine {
         */
        public function replaceTableWrap($arr, $rec, $table) {
                // Make "new"-label
-               $lang = $this->getLanguageService();
+               $languageService = $this->getLanguageService();
                if (strstr($rec['uid'], 'NEW')) {
-                       $newLabel = ' <span class="typo3-TCEforms-newToken">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', TRUE) . '</span>';
+                       $newLabel = ' <span class="typo3-TCEforms-newToken">' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', TRUE) . '</span>';
                        // BackendUtility::fixVersioningPid Should not be used here because NEW records are not offline workspace versions...
                        $truePid = BackendUtility::getTSconfig_pidValue($table, $rec['uid'], $rec['pid']);
                        $prec = BackendUtility::getRecordWSOL('pages', $truePid, 'title');
                        $pageTitle = BackendUtility::getRecordTitle('pages', $prec, TRUE, FALSE);
                        $rLabel = '<em>[PID: ' . $truePid . '] ' . $pageTitle . '</em>';
                        // Fetch translated title of the table
-                       $tableTitle = $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
+                       $tableTitle = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
                        if ($table === 'pages') {
-                               $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewPage', TRUE);
+                               $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewPage', TRUE);
                                $pageTitle = sprintf($label, $tableTitle);
                        } else {
-                               $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecord', TRUE);
+                               $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecord', TRUE);
                                if ($rec['pid'] == 0) {
-                                       $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecordRootLevel', TRUE);
+                                       $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecordRootLevel', TRUE);
                                }
                                $pageTitle = sprintf($label, $tableTitle, $pageTitle);
                        }
@@ -3629,19 +3634,19 @@ class FormEngine {
                        $rLabel = BackendUtility::getRecordTitle($table, $rec, TRUE, FALSE);
                        $prec = BackendUtility::getRecordWSOL('pages', $rec['pid'], 'uid,title');
                        // Fetch translated title of the table
-                       $tableTitle = $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
+                       $tableTitle = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
                        if ($table === 'pages') {
-                               $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.editPage', TRUE);
+                               $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editPage', TRUE);
                                // Just take the record title and prepend an edit label.
                                $pageTitle = sprintf($label, $tableTitle, $rLabel);
                        } else {
-                               $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecord', TRUE);
+                               $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecord', TRUE);
                                $pageTitle = BackendUtility::getRecordTitle('pages', $prec, TRUE, FALSE);
                                if ($rLabel === BackendUtility::getNoRecordTitle(TRUE)) {
-                                       $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordNoTitle', TRUE);
+                                       $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordNoTitle', TRUE);
                                }
                                if ($rec['pid'] == 0) {
-                                       $label = $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordRootLevel', TRUE);
+                                       $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordRootLevel', TRUE);
                                }
                                if ($rLabel !== BackendUtility::getNoRecordTitle(TRUE)) {
                                        // Just take the record title and prepend an edit label.
@@ -3666,7 +3671,7 @@ class FormEngine {
                                        $pageTitle,
                                        $newLabel,
                                        $rLabel,
-                                       htmlspecialchars($this->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
+                                       htmlspecialchars($languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
                                        IconUtility::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec)))
                                ),
                                $arr[$k]
@@ -4214,8 +4219,10 @@ class FormEngine {
         *
         * @param string $str Language label reference, eg. 'LLL:EXT:lang/locallang_core.xlf:labels.blablabla'
         * @return string The value of the label, fetched for the current backend language.
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function sL($str) {
+               GeneralUtility::logDeprecatedFunction();
                return $this->getLanguageService()->sL($str);
        }
 
@@ -4379,7 +4386,7 @@ class FormEngine {
        protected function getMergeBehaviourIcon($l10nMode) {
                $icon = '';
                if ($l10nMode === 'mergeIfNotBlank') {
-                       $icon = IconUtility::getSpriteIcon('actions-edit-merge-localization', array('title' => $this->sL('LLL:EXT:lang/locallang_misc.xlf:localizeMergeIfNotBlank')));
+                       $icon = IconUtility::getSpriteIcon('actions-edit-merge-localization', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:localizeMergeIfNotBlank')));
                }
                return $icon;
        }
@@ -4560,7 +4567,7 @@ class FormEngine {
                $value = $this->getPlaceholderValue($table, $field, $config, $row);
 
                // Cleanup the string and support 'LLL:'
-               $value = htmlspecialchars(trim($this->sL($value)));
+               $value = htmlspecialchars(trim($this->getLanguageService()->sL($value)));
                return empty($value) ? '' : ' placeholder="' . $value . '" ';
        }
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63855-FormEngine-sL.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63855-FormEngine-sL.rst
new file mode 100644 (file)
index 0000000..fdab666
--- /dev/null
@@ -0,0 +1,26 @@
+==============================================
+Deprecation: #63855 - Deprecate FormEngine::sL
+==============================================
+
+Description
+===========
+
+:php:`FormEngine::sL()` has been marked as deprecated.
+
+
+Impact
+======
+
+Calling :php:`sL()` of FormEngine class will trigger a deprecation log message.
+
+
+Affected installations
+======================
+
+Instances which use custom form elements, that use :php:`FormEngine::sL()`.
+
+
+Migration
+=========
+
+Use :php:`getLanguageService()` instead.