[!!!][TASK] Deprecate FormEngine::renderVDEFDiff() 90/35490/5
authorFrank Nägler <typo3@naegler.net>
Mon, 15 Dec 2014 18:04:39 +0000 (19:04 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Mon, 15 Dec 2014 18:22:54 +0000 (19:22 +0100)
This patch deprecates FormEngine::renderVDEFDiff() and removes
the dependency from all form element classes.

Resolves: #63864
Releases: master
Change-Id: Ib4dbdddde76554147b1328645e2e90107e2ddbca
Reviewed-on: http://review.typo3.org/35490
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Classes/Form/Element/FlexElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-63864-FormEngine-renderVDEFDiff.rst [new file with mode: 0644]

index be5a089..792a5e2 100644 (file)
@@ -498,7 +498,7 @@ class FlexElement extends AbstractFormElement {
                                                                        . '<div class="t3-form-field-label t3-form-field-label-flex">' . $languageIcon
                                                                        . BackendUtility::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '</div>
                                                                        <div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo
-                                                                       . $this->formEngine->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
+                                                                       . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
                                                                </div>';
                                                        }
                                                }
@@ -511,4 +511,26 @@ class FlexElement extends AbstractFormElement {
                }
                return $output;
        }
+
+       /**
+        * Renders the diff-view of vDEF fields in flexforms
+        *
+        * @param array $vArray Record array of the record being edited
+        * @param string $vDEFkey HTML of the form field. This is what we add the content to.
+        * @return string Item string returned again, possibly with the original value added to.
+        */
+       protected function renderVDEFDiff($vArray, $vDEFkey) {
+               $item = NULL;
+               if (
+                       $GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && isset($vArray[$vDEFkey . '.vDEFbase'])
+                       && (string)$vArray[$vDEFkey . '.vDEFbase'] !== (string)$vArray['vDEF']
+               ) {
+                       // Create diff-result:
+                       $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->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.changeInOrig')) . ':</div>' . $diffres . '</div>';
+               }
+               return $item;
+       }
 }
index 993deaa..1e340ad 100644 (file)
@@ -2203,8 +2203,10 @@ class FormEngine {
         * @param string $vDEFkey HTML of the form field. This is what we add the content to.
         * @return string Item string returned again, possibly with the original value added to.
         * @see getSingleField(), registerDefaultLanguageData()
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function renderVDEFDiff($vArray, $vDEFkey) {
+               GeneralUtility::logDeprecatedFunction();
                $item = NULL;
                if (
                        $GLOBALS['TYPO3_CONF_VARS']['BE']['flexFormXMLincludeDiffBase'] && isset($vArray[$vDEFkey . '.vDEFbase'])
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63864-FormEngine-renderVDEFDiff.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-63864-FormEngine-renderVDEFDiff.rst
new file mode 100644 (file)
index 0000000..ce84822
--- /dev/null
@@ -0,0 +1,26 @@
+==========================================================
+Deprecation: #63864 - Deprecate FormEngine::renderVDEFDiff
+==========================================================
+
+Description
+===========
+
+:php:`FormEngine::renderVDEFDiff()` has been deprecated.
+
+
+Impact
+======
+
+Using :php:`FormEngine::renderVDEFDiff()` of FormEngine class will trigger a deprecation log message.
+
+
+Affected installations
+======================
+
+Instances which use custom form elements, which make use of :php:`FormEngine::renderVDEFDiff()`.
+
+
+Migration
+=========
+
+No mirgration possible.