[!!!][TASK] Deprecate FormEngine::getLL() 68/35468/5
authorFrank Nägler <typo3@naegler.net>
Mon, 15 Dec 2014 09:40:57 +0000 (10:40 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Mon, 15 Dec 2014 11:50:17 +0000 (12:50 +0100)
This patch deprecates FormEngine::getLL() and removes
the dependency from all form element classes.

Resolves: #63878
Releases: master
Change-Id: I3f247a7241fb587d0a3c5a0a36b62968140f84c8
Reviewed-on: http://review.typo3.org/35468
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Classes/Form/Element/GroupElement.php
typo3/sysext/backend/Classes/Form/Element/SelectElement.php
typo3/sysext/backend/Classes/Form/Element/TextElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-63878-FormEngine-getLL.rst [new file with mode: 0644]

index 06238ce..bd632f1 100644 (file)
@@ -226,7 +226,7 @@ class GroupElement extends AbstractFormElement {
                                $tempFT = GeneralUtility::trimExplode(',', $allowed, TRUE);
                                $onlySingleTableAllowed = FALSE;
                                if (trim($tempFT[0]) === '*') {
-                                       $info .= '<span class="nobr">' . htmlspecialchars($this->formEngine->getLL('l_allTables')) . '</span><br />';
+                                       $info .= '<span class="nobr">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables')) . '</span><br />';
                                } elseif ($tempFT) {
                                        $onlySingleTableAllowed = count($tempFT) == 1;
                                        foreach ($tempFT as $theT) {
index 8bf29a5..ae574d0 100644 (file)
@@ -79,7 +79,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->formEngine->getLL('l_noMatchingValue') . ' ]';
+                       : '[ ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue') . ' ]';
                // Prepare some values:
                $maxitems = (int)$config['maxitems'];
                // If a SINGLE selector box...
@@ -125,6 +125,7 @@ class SelectElement extends AbstractFormElement {
         * @see getSingleField_typeSelect()
         */
        public function getSingleField_typeSelect_multiple($table, $field, $row, &$PA, $config, $selItems, $nMV_label) {
+               $languageService = $this->getLanguageService();
                $item = '';
                $disabled = '';
                if ($this->formEngine->renderReadonly || $config['readOnly']) {
@@ -259,8 +260,8 @@ class SelectElement extends AbstractFormElement {
                        'maxitems' => $maxitems,
                        'info' => '',
                        'headers' => array(
-                               'selector' => $this->formEngine->getLL('l_selected') . ':<br />',
-                               'items' => '<div class="pull-left">' . $this->formEngine->getLL('l_items') . ':</div>' . $selectBoxFilterContents
+                               'selector' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.selected') . ':<br />',
+                               'items' => '<div class="pull-left">' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.items') . ':</div>' . $selectBoxFilterContents
                        ),
                        'noBrowser' => 1,
                        'thumbnails' => $itemsToSelect,
@@ -673,7 +674,7 @@ class SelectElement extends AbstractFormElement {
                // Add revert icon
                if (!empty($restoreCmd)) {
                        $item .= '<a href="#" onclick="' . implode('', $restoreCmd) . ' return false;' . '">'
-                               . IconUtility::getSpriteIcon('actions-edit-undo', array('title' => htmlspecialchars($this->formEngine->getLL('l_revertSelection')))) . '</a>';
+                               . IconUtility::getSpriteIcon('actions-edit-undo', array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.revertSelection')))) . '</a>';
                }
                return $item;
        }
@@ -693,6 +694,7 @@ class SelectElement extends AbstractFormElement {
         * @see getSingleField_typeSelect()
         */
        public function getSingleField_typeSelect_singlebox($table, $field, $row, &$PA, $config, $selItems, $nMV_label) {
+               $languageService = $this->getLanguageService();
                // Get values in an array (and make unique, which is fine because there can be no duplicates anyway):
                $itemArray = array_flip($this->formEngine->extractValuesOnlyFromValueLabelList($PA['itemFormElValue']));
                $item = '';
@@ -766,10 +768,10 @@ class SelectElement extends AbstractFormElement {
                                        <td>
                                        ' . $selectBox . '
                                        <br/>
-                                       <em>' . htmlspecialchars($this->formEngine->getLL('l_holdDownCTRL')) . '</em>
+                                       <em>' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.holdDownCTRL')) . '</em>
                                        </td>
                                        <td valign="top">
-                                               <a href="#" onclick="' . $onClick . '" title="' . htmlspecialchars($this->formEngine->getLL('l_revertSelection')) . '">'
+                                               <a href="#" onclick="' . $onClick . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.revertSelection')) . '">'
                        . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>
                                        </td>
                                </tr>
index b441693..40df141 100644 (file)
@@ -145,7 +145,7 @@ class TextElement extends AbstractFormElement {
                if (!$rteWasLoaded) {
                        // Show message, if no RTE (field can only be edited with RTE!)
                        if ($specialConfiguration['rte_only']) {
-                               $item = '<p><em>' . htmlspecialchars($this->formEngine->getLL('l_noRTEfound')) . '</em></p>';
+                               $item = '<p><em>' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noRTEfound')) . '</em></p>';
                        } else {
                                if ($specialConfiguration['nowrap']) {
                                        $wrap = 'off';
index 65a06f3..d0a5605 100644 (file)
@@ -760,13 +760,14 @@ class FormEngine {
         * @see getSoloField()
         */
        public function getMainFields($table, array $row, $depth = 0, array $overruleTypesArray = array()) {
+               $languageService = $this->getLanguageService();
                $this->renderDepth = $depth;
                // Init vars:
                $out_array = array(array());
                $out_array_meta = array(
                        array(
-                               'title' => $this->getLL('l_generalTab')
-                       )
+                               'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.generalTab'),
+                       ),
                );
                $out_pointer = 0;
                $out_sheet = 0;
@@ -889,7 +890,9 @@ class FormEngine {
                                if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP])) {
                                        $temp_palettesCollapsed = $this->palettesCollapsed;
                                        $this->palettesCollapsed = FALSE;
-                                       $label = $i == 0 ? $this->getLL('l_generalOptions') : $this->getLL('l_generalOptions_more');
+                                       $label = $i == 0
+                                               ? $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.generalOptions')
+                                               : $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.generalOptions_more');
                                        $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $mP, $label);
                                        $this->palettesCollapsed = $temp_palettesCollapsed;
                                        $this->palettesRendered[$this->renderDepth][$table][$mP] = 1;
@@ -1008,7 +1011,16 @@ class FormEngine {
                                $isHiddenPalette = !empty($GLOBALS['TCA'][$table]['palettes'][$palette]['isHiddenPalette']);
                                $thePalIcon = '';
                                if ($collapsed && $collapsedHeader !== NULL && !$isHiddenPalette) {
-                                       list($thePalIcon, ) = $this->wrapOpenPalette(IconUtility::getSpriteIcon('actions-system-options-view', array('title' => htmlspecialchars($this->getLL('l_moreOptions')))), $table, $row, $palette, 1);
+                                       list($thePalIcon, ) = $this->wrapOpenPalette(
+                                               IconUtility::getSpriteIcon(
+                                                       'actions-system-options-view',
+                                                       array('title' => htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.moreOptions')))
+                                               ),
+                                               $table,
+                                               $row,
+                                               $palette,
+                                               1
+                                       );
                                        $thePalIcon = '<span style="margin-left: 20px;">' . $thePalIcon . $collapsedHeader . '</span>';
                                }
                                $paletteHtml = $this->wrapPaletteField($this->printPalette($parts), $table, $row, $palette, $collapsed);
@@ -1120,7 +1132,16 @@ class FormEngine {
                                        if (!$PA['palette']) {
                                                $paletteFields = $this->loadPaletteElements($table, $row, $PA['pal']);
                                                if ($PA['pal'] && $this->isPalettesCollapsed($table, $PA['pal']) && count($paletteFields)) {
-                                                       list($thePalIcon, $palJSfunc) = $this->wrapOpenPalette(IconUtility::getSpriteIcon('actions-system-options-view', array('title' => htmlspecialchars($this->getLL('l_moreOptions')))), $table, $row, $PA['pal'], 1);
+                                                       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')))
+                                                               ),
+                                                               $table,
+                                                               $row,
+                                                               $PA['pal'],
+                                                               1
+                                                       );
                                                }
                                        }
                                        // onFocus attribute to add to the field:
@@ -2159,7 +2180,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->getLL('l_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>';
                                }
@@ -2186,7 +2207,7 @@ class FormEngine {
                        $t3lib_diff_Obj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\DiffUtility::class);
                        $diffres = $t3lib_diff_Obj->makeDiffDisplay($vArray[$vDEFkey . '.vDEFbase'], $vArray['vDEF']);
                        $item = '<div class="typo3-TCEforms-diffBox">' . '<div class="typo3-TCEforms-diffBox-header">'
-                               . htmlspecialchars($this->getLL('l_changeInOrig')) . ':</div>' . $diffres . '</div>';
+                               . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.changeInOrig')) . ':</div>' . $diffres . '</div>';
                }
                return $item;
        }
@@ -2214,6 +2235,7 @@ class FormEngine {
         * @throws \UnexpectedValueException
         */
        public function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $table = '', $field = '', $uid = '', $config = array()) {
+               $languageService = $this->getLanguageService();
                $disabled = '';
                if ($this->renderReadonly || $params['readOnly']) {
                        $disabled = ' disabled="disabled"';
@@ -2310,7 +2332,7 @@ class FormEngine {
                                $aOnClick = 'setFormValueOpenBrowser(\'' . $elementBrowserType . '\',\''
                                        . ($fName . '|||' . $elementBrowserAllowed . '|' . $aOnClickInline) . '\'); return false;';
                                $spriteIcon = IconUtility::getSpriteIcon('actions-insert-record', array(
-                                       'title' => htmlspecialchars($this->getLL('l_browse_' . ($mode == 'db' ? 'db' : 'file')))
+                                       'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.browse_' . ($mode == 'db' ? 'db' : 'file')))
                                ));
                                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" class="btn btn-default">' . $spriteIcon . '</a>';
                        }
@@ -2319,24 +2341,24 @@ class FormEngine {
                                        $icons['L'][] = IconUtility::getSpriteIcon('actions-move-to-top', array(
                                                'data-fieldname' => $fName,
                                                'class' => 't3-btn t3-btn-moveoption-top',
-                                               'title' => htmlspecialchars($this->getLL('l_move_to_top'))
+                                               'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_top'))
                                        ));
                                }
                                $icons['L'][] = IconUtility::getSpriteIcon('actions-move-up', array(
                                        'data-fieldname' => $fName,
                                        'class' => 't3-btn t3-btn-moveoption-up',
-                                       'title' => htmlspecialchars($this->getLL('l_move_up'))
+                                       'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_up'))
                                ));
                                $icons['L'][] = IconUtility::getSpriteIcon('actions-move-down', array(
                                        'data-fieldname' => $fName,
                                        'class' => 't3-btn t3-btn-moveoption-down',
-                                       'title' => htmlspecialchars($this->getLL('l_move_down'))
+                                       'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_down'))
                                ));
                                if ($sSize >= 5) {
                                        $icons['L'][] = IconUtility::getSpriteIcon('actions-move-to-bottom', array(
                                                'data-fieldname' => $fName,
                                                'class' => 't3-btn t3-btn-moveoption-bottom',
-                                               'title' => htmlspecialchars($this->getLL('l_move_to_bottom'))
+                                               'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_bottom'))
                                        ));
                                }
                        }
@@ -2358,7 +2380,7 @@ class FormEngine {
                                }
                                $aOnClick .= 'return false;';
                                $spriteIcon1 = IconUtility::getSpriteIcon('actions-document-paste-into', array(
-                                       'title' => htmlspecialchars(sprintf($this->getLL('l_clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements)))
+                                       'title' => htmlspecialchars(sprintf($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements)))
                                ));
                                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $spriteIcon1 . '</a>';
                        }
@@ -2368,7 +2390,7 @@ class FormEngine {
                                'onclick' => $rOnClickInline,
                                'data-fieldname' => $fName,
                                'class' => 't3-btn t3-btn-removeoption',
-                               'title' => htmlspecialchars($this->getLL('l_remove_selected'))
+                               'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.remove_selected'))
 
                        ));
                }
@@ -2616,7 +2638,7 @@ class FormEngine {
                                                                                        // Current form value is passed as P[currentValue]!
                                                                                        $addJS = $wConf['popup_onlyOpenIfSelected']
                                                                                                ? 'if (!TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')){alert('
-                                                                                                       . GeneralUtility::quoteJSvalue($this->getLL('m_noSelItemForEdit'))
+                                                                                                       . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.noSelItemForEdit'))
                                                                                                        . '); return false;}'
                                                                                                : '';
                                                                                        $curSelectedValues = '+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')';
@@ -3905,6 +3927,7 @@ class FormEngine {
         * @return string A section with JavaScript - if $update is FALSE, embedded in <script></script>
         */
        public function JSbottom($formname = 'forms[0]', $update = FALSE) {
+               $languageService = $this->getLanguageService();
                $jsFile = array();
                $elements = array();
                $out = '';
@@ -4003,10 +4026,10 @@ class FormEngine {
                        TBE_EDITOR.prependFormFieldNamesCnt = ' . substr_count($this->prependFormFieldNames, '[') . ';
                        TBE_EDITOR.isPalettedoc = ' . ($this->isPalettedoc ? addslashes($this->isPalettedoc) : 'null') . ';
                        TBE_EDITOR.doSaveFieldName = "' . ($this->doSaveFieldName ? addslashes($this->doSaveFieldName) : '') . '";
-                       TBE_EDITOR.labels.fieldsChanged = ' . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.fieldsChanged')) . ';
-                       TBE_EDITOR.labels.fieldsMissing = ' . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.fieldsMissing')) . ';
-                       TBE_EDITOR.labels.refresh_login = ' . GeneralUtility::quoteJSvalue($this->getLL('m_refresh_login')) . ';
-                       TBE_EDITOR.labels.onChangeAlert = ' . GeneralUtility::quoteJSvalue($this->getLL('m_onChangeAlert')) . ';
+                       TBE_EDITOR.labels.fieldsChanged = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.fieldsChanged')) . ';
+                       TBE_EDITOR.labels.fieldsMissing = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.fieldsMissing')) . ';
+                       TBE_EDITOR.labels.refresh_login = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login')) . ';
+                       TBE_EDITOR.labels.onChangeAlert = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.onChangeAlert')) . ';
                        evalFunc.USmode = ' . ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? '1' : '0') . ';
                        TBE_EDITOR.backend_interface = "' . $beUserAuth->uc['interfaceSetup'] . '";
 
@@ -4205,8 +4228,10 @@ class FormEngine {
         *
         * @param string $str The label key
         * @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 getLL($str) {
+               GeneralUtility::logDeprecatedFunction();
                $content = '';
                switch (substr($str, 0, 2)) {
                        case 'l_':
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63878-FormEngine-getLL.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63878-FormEngine-getLL.rst
new file mode 100644 (file)
index 0000000..c64fa4f
--- /dev/null
@@ -0,0 +1,26 @@
+=================================================
+Deprecation: #63878 - Deprecate FormEngine::getLL
+=================================================
+
+Description
+===========
+
+FormEngine::getLL() is deprecated.
+
+
+Impact
+======
+
+Using ``getLL()`` of FormEngine class will trigger a deprecation log message.
+
+
+Affected installations
+======================
+
+Instances which use custom form elements, which make use of ``FormEngine::getLL()``.
+
+
+Migration
+=========
+
+Use methods like ``sL`` of the languageService directly.
\ No newline at end of file