diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
index 523b06867c8d2433c612616fce403278bdbc2866..c21b509bc0f00895203a0f0b5bc909fe81262bc9 100644
--- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
+++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
@@ -174,6 +174,7 @@ class EditDocumentController {
 	 * Disable help... ?
 	 *
 	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
 	public $disHelp;
 
@@ -523,7 +524,6 @@ class EditDocumentController {
 			$tce->neverHideAtCopy = 1;
 		}
 		$tce->debug = 0;
-		$tce->disableRTE = !$GLOBALS['BE_USER']->isRTE();
 		// Loading TCEmain with data:
 		$tce->start($this->data, $this->cmd);
 		if (is_array($this->mirror)) {
@@ -628,7 +628,6 @@ class EditDocumentController {
 		$this->viewUrl = GeneralUtility::_GP('viewUrl');
 		$this->editRegularContentFromId = GeneralUtility::_GP('editRegularContentFromId');
 		$this->recTitle = GeneralUtility::_GP('recTitle');
-		$this->disHelp = GeneralUtility::_GP('disHelp');
 		$this->noView = GeneralUtility::_GP('noView');
 		$this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
 		// Set other internal variables:
@@ -714,16 +713,6 @@ class EditDocumentController {
 			// text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
 			$this->tceforms->returnUrl = $this->R_URI;
 			$this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
-			$this->tceforms->disableRTE = !$GLOBALS['BE_USER']->isRTE();
-			$this->tceforms->enableClickMenu = TRUE;
-			$this->tceforms->enableTabMenu = TRUE;
-			// Clipboard is initialized:
-			// Start clipboard
-			$this->tceforms->clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
-			// Initialize - reads the clipboard content from the user session
-			$this->tceforms->clipObj->initializeClipboard();
-			// Setting external variables:
-			$this->tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
 			if ($this->editRegularContentFromId) {
 				$this->editRegularContentFromId();
 			}
@@ -743,7 +732,6 @@ class EditDocumentController {
 				$body .= $this->compileForm($editForm);
 				$body .= $this->tceforms->printNeededJSFunctions();
 				$body .= $this->functionMenus();
-				$body .= $this->tceformMessages();
 			}
 		}
 		// Access check...
@@ -891,7 +879,6 @@ class EditDocumentController {
 								$trData->addRawData = TRUE;
 								$trData->defVals = $this->defVals;
 								$trData->lockRecords = 1;
-								$trData->disableRTE = !$GLOBALS['BE_USER']->isRTE();
 								$trData->prevPageID = $prevPageID;
 								// 'new'
 								$trData->fetchRecord($table, $theUid, $cmd == 'new' ? 'new' : '');
@@ -916,7 +903,6 @@ class EditDocumentController {
 									}
 									// Setting variables in TCEforms object:
 									$this->tceforms->hiddenFieldList = '';
-									$this->tceforms->globalShowHelp = !$this->disHelp;
 									if (is_array($this->overrideVals) && is_array($this->overrideVals[$table])) {
 										$this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
 									}
@@ -1144,7 +1130,7 @@ class EditDocumentController {
 		if ($this->returnUrl == 'close.html' || !$GLOBALS['BE_USER']->mayMakeShortcut()) {
 			return '';
 		}
-		return $this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,disHelp,noView', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'], 1);
+		return $this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,noView', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'], 1);
 	}
 
 	/**
@@ -1163,17 +1149,12 @@ class EditDocumentController {
 	/**
 	 * Reads comment messages from TCEforms and prints them in a HTML comment in the bottom of the page.
 	 *
-	 * @return void
+	 * @return string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
 	public function tceformMessages() {
-		if (count($this->tceforms->commentMessages)) {
-			$tceformMessages = '
-				<!-- TCEFORM messages
-				' . htmlspecialchars(implode(LF, $this->tceforms->commentMessages)) . '
-				-->
-			';
-		}
-		return $tceformMessages;
+		GeneralUtility::logDeprecatedFunction();
+		return '';
 	}
 
 	/***************************
@@ -1429,7 +1410,7 @@ class EditDocumentController {
 	 * @see makeDocSel()
 	 */
 	public function compileStoreDat() {
-		$this->storeArray = GeneralUtility::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId,workspace', $this->R_URL_getvars);
+		$this->storeArray = GeneralUtility::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,noView,editRegularContentFromId,workspace', $this->R_URL_getvars);
 		$this->storeUrl = GeneralUtility::implodeArrayForUrl('', $this->storeArray);
 		$this->storeUrlMd5 = md5($this->storeUrl);
 	}
diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
index 3a3aaa6189c2870e4f93d921df45454916ec5100..0b3561463534b9c663e60945564a82caa9514e0e 100644
--- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
+++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php
@@ -302,7 +302,6 @@ class PageLayoutController {
 			'tt_content_showHidden' => '',
 			'showPalettes' => '',
 			'showDescriptions' => '',
-			'disableRTE' => '',
 			'function' => array(
 				0 => $GLOBALS['LANG']->getLL('m_function_0'),
 				1 => $GLOBALS['LANG']->getLL('m_function_1'),
@@ -774,7 +773,6 @@ class PageLayoutController {
 				'colPos' => (int)$ex_colPos,
 				'sys_language_uid' => (int)$this->current_sys_language
 			);
-			$trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
 			$trData->lockRecords = 1;
 			// 'new'
 			$trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal);
@@ -798,18 +796,9 @@ class PageLayoutController {
 				// If the record is an array (which it will always be... :-)
 				// Create instance of TCEforms, setting defaults:
 				$tceforms = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormEngine::class);
-				$tceforms->backPath = $GLOBALS['BACK_PATH'];
 				$tceforms->initDefaultBEMode();
 				$tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder'];
 				$tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
-				$tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
-				$tceforms->enableClickMenu = TRUE;
-				$tceforms->enableTabMenu = TRUE;
-				// Clipboard is initialized:
-				// Start clipboard
-				$tceforms->clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
-				// Initialize - reads the clipboard content from the user session
-				$tceforms->clipObj->initializeClipboard();
 				// Render form, wrap it:
 				$panel = '';
 				$panel .= $tceforms->getMainFields($this->eRParts[0], $rec);
@@ -821,7 +810,6 @@ class PageLayoutController {
 				}
 				$theCode .= '
 					<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />
-					<input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE . '" />
 					<input type="hidden" name="edit_record" value="' . $edit_record . '" />
 					<input type="hidden" name="redirect" value="' . htmlspecialchars(($uidVal == 'new' ? BackendUtility::getModuleUrl(
 						'web_layout',
@@ -875,14 +863,6 @@ class PageLayoutController {
 				'</label>' .
 				'</div>';
 		}
-		if ($GLOBALS['BE_USER']->isRTE()) {
-			$h_func_b .= '<div class="checkbox">' .
-				'<label for="checkDisableRTE">' .
-				BackendUtility::getFuncCheck($this->id, 'SET[disableRTE]', $this->MOD_SETTINGS['disableRTE'], '', '', 'id="checkDisableRTE"') .
-				$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.disableRTE', TRUE) .
-				'</label>' .
-				'</div>';
-		}
 		// Add the function menus to bottom:
 		$content .= $this->doc->section('', $h_func_b, 0, 0);
 		$content .= $this->doc->spacer(10);
@@ -899,14 +879,6 @@ class PageLayoutController {
 			$content .= $this->doc->section($GLOBALS['LANG']->getLL('CEonThisPage'), $HTMLcode, 0, 1);
 			$content .= $this->doc->spacer(20);
 		}
-		// Finally, if comments were generated in TCEforms object, print these as a HTML comment:
-		if (count($tceforms->commentMessages)) {
-			$content .= '
-	<!-- TCEFORM messages
-	' . htmlspecialchars(implode(LF, $tceforms->commentMessages)) . '
-	-->
-	';
-		}
 		return $content;
 	}
 
diff --git a/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php b/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
index b24cbd5e889b767b6d73c15ece89a02c62a953b5..f136ae469fe77bd5a2b69f538b04ea1046df5c9c 100644
--- a/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
+++ b/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
@@ -136,7 +136,6 @@ class SimpleDataHandlerController {
 		$this->cacheCmd = GeneralUtility::_GP('cacheCmd');
 		$this->redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
 		$this->prErr = GeneralUtility::_GP('prErr');
-		$this->_disableRTE = GeneralUtility::_GP('_disableRTE');
 		$this->CB = GeneralUtility::_GP('CB');
 		$this->vC = GeneralUtility::_GP('vC');
 		$this->uPT = GeneralUtility::_GP('uPT');
diff --git a/typo3/sysext/backend/Classes/Controller/Wizard/RteController.php b/typo3/sysext/backend/Classes/Controller/Wizard/RteController.php
index 72088acaa982adee29eda4904e306c46ffb8fe7a..645d00a9f5966e3c82177407af5f000064032885 100644
--- a/typo3/sysext/backend/Classes/Controller/Wizard/RteController.php
+++ b/typo3/sysext/backend/Classes/Controller/Wizard/RteController.php
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -148,7 +149,7 @@ class RteController extends AbstractWizardController {
 			$rec['uid'] = $this->P['uid'];
 			$rec['pid'] = $rawRec['pid'];
 			// TSconfig, setting width:
-			$fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
+			$fieldTSConfig = FormEngineUtility::getTSconfigForTableRow($this->P['table'], $rec, $this->P['field']);
 			if ((string)$fieldTSConfig['RTEfullScreenWidth'] !== '') {
 				$width = $fieldTSConfig['RTEfullScreenWidth'];
 			} else {
diff --git a/typo3/sysext/backend/Classes/Form/DataPreprocessor.php b/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
index eea8987610a9520ad1f657bcdb11e85ddd23172c..54f5281901bb96aa5993df25f2323f4b3ddd333f 100644
--- a/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
+++ b/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
@@ -19,6 +19,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Lang\LanguageService;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 
 /**
  * Class for getting and transforming data for display in backend forms (TCEforms)
@@ -38,6 +40,7 @@ class DataPreprocessor {
 	 * Is set externally if RTE is disabled.
 	 *
 	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
 	public $disableRTE = 0;
 
@@ -854,6 +857,7 @@ class DataPreprocessor {
 	 * @see procesItemArray()
 	 */
 	public function procItems($items, $itemsProcFuncTSconfig, $config, $table, $row, $field) {
+		$languageService = $this->getLanguageService();
 		$params = array();
 		$params['items'] = &$items;
 		$params['config'] = $config;
@@ -861,7 +865,33 @@ class DataPreprocessor {
 		$params['table'] = $table;
 		$params['row'] = $row;
 		$params['field'] = $field;
-		GeneralUtility::callUserFunction($config['itemsProcFunc'], $params, $this);
+		// The itemsProcFunc method may throw an exception.
+		// If it does display an error message and return items unchanged.
+		try {
+			GeneralUtility::callUserFunction($config['itemsProcFunc'], $params, $this);
+		} catch (\Exception $exception) {
+			$fieldLabel = $field;
+			if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) {
+				$fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']);
+			}
+			$message = sprintf(
+				$languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.items_proc_func_error'),
+				$fieldLabel,
+				$exception->getMessage()
+			);
+			/** @var FlashMessage $flashMessage */
+			$flashMessage = GeneralUtility::makeInstance(
+				FlashMessage::class,
+				htmlspecialchars($message),
+				'',
+				FlashMessage::ERROR,
+				TRUE
+			);
+			/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+			$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+			$defaultFlashMessageQueue->enqueue($flashMessage);
+		}
 		return $items;
 	}
 
diff --git a/typo3/sysext/backend/Classes/Form/DatabaseFileIconsHookInterface.php b/typo3/sysext/backend/Classes/Form/DatabaseFileIconsHookInterface.php
index aa83652d8e156bf92389105d8d77e2a4a85ca176..8e6102ee59127b8c463b435077dac7f4d05b1514 100644
--- a/typo3/sysext/backend/Classes/Form/DatabaseFileIconsHookInterface.php
+++ b/typo3/sysext/backend/Classes/Form/DatabaseFileIconsHookInterface.php
@@ -33,9 +33,9 @@ interface DatabaseFileIconsHookInterface {
 	 * @param string $fName Form element name
 	 * @param array $uidList The array of item-uids. Have a look at \TYPO3\CMS\Backend\Form\FormEngine::dbFileIcons parameter "$itemArray
 	 * @param array $additionalParams Array with additional parameters which are be available at method call. Includes $mode, $allowed, $itemArray, $onFocus, $table, $field, $uid. For more information have a look at PHPDoc-Comment of \TYPO3\CMS\Backend\Form\FormEngine::dbFileIcons
-	 * @param \TYPO3\CMS\Backend\Form\FormEngine $parentObject Parent object
+	 * @param object $parentObject Parent object
 	 * @return void
 	 */
-	public function dbFileIcons_postProcess(array &$params, &$selector, &$thumbnails, array &$icons, &$rightbox, &$fName, array &$uidList, array $additionalParams, \TYPO3\CMS\Backend\Form\FormEngine $parentObject);
+	public function dbFileIcons_postProcess(array &$params, &$selector, &$thumbnails, array &$icons, &$rightbox, &$fName, array &$uidList, array $additionalParams, $parentObject);
 
 }
diff --git a/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php b/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
index 6acb7b8fd3a1226024ecdde8357e424118ed290d..3625081394579ae2752c968a82277f957c3a2059 100644
--- a/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
@@ -15,10 +15,21 @@ namespace TYPO3\CMS\Backend\Form\Element;
  */
 
 use TYPO3\CMS\Backend\Form\FormEngine;
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Backend\Form\Wizard\SuggestWizard;
+use TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
+use TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface;
+use TYPO3\CMS\Backend\Clipboard\Clipboard;
 
 /**
  * Base class for form elements of FormEngine
@@ -31,9 +42,37 @@ abstract class AbstractFormElement {
 	protected $formEngine;
 
 	/**
-	 * @var bool If TRUE, the element will not be editable
+	 * A list of global options given from FormEngine to child elements
+	 *
+	 * @var array
+	 */
+	protected $globalOptions = array();
+
+	/**
+	 * Default width value for a couple of elements like text
+	 *
+	 * @var int
+	 */
+	protected $defaultInputWidth = 30;
+
+	/**
+	 * Minimum width value for a couple of elements like text
+	 *
+	 * @var int
+	 */
+	protected $minimumInputWidth = 10;
+
+	/**
+	 * Maximum width value for a couple of elements like text
+	 *
+	 * @var int
 	 */
-	protected $renderReadonly = FALSE;
+	protected $maxInputWidth = 50;
+
+	/**
+	 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard|NULL
+	 */
+	protected $clipboard = NULL;
 
 	/**
 	 * Constructor function, setting the FormEngine
@@ -45,20 +84,13 @@ abstract class AbstractFormElement {
 	}
 
 	/**
-	 * @return bool TRUE if field is set to read only
-	 */
-	public function isRenderReadonly() {
-		return $this->renderReadonly;
-	}
-
-	/**
-	 * Set render read only state
+	 * Set global options from parent FormEngine instance
 	 *
-	 * @param bool $renderReadonly
+	 * @param array $globalOptions Global options like 'readonly' for all elements
 	 * @return AbstractFormElement
 	 */
-	public function setRenderReadonly($renderReadonly) {
-		$this->renderReadonly = (bool)$renderReadonly;
+	public function setGlobalOptions(array $globalOptions) {
+		$this->globalOptions = $globalOptions;
 		return $this;
 	}
 
@@ -73,6 +105,802 @@ abstract class AbstractFormElement {
 	 */
 	abstract public function render($table, $field, $row, &$additionalInformation);
 
+	/**
+	 * @return bool TRUE if field is set to read only
+	 */
+	protected function isGlobalReadonly() {
+		return !empty($this->globalOptions['renderReadonly']);
+	}
+
+	/**
+	 * @return bool TRUE if wizards are disabled on a global level
+	 */
+	protected function isWizardsDisabled() {
+		return !empty($this->globalOptions['disabledWizards']);
+	}
+
+	/**
+	 * @return string URL to return to this entry script
+	 */
+	protected function getReturnUrl() {
+		return isset($this->globalOptions['returnUrl']) ? $this->globalOptions['returnUrl'] : '';
+	}
+
+	/**
+	 * Returns the max width in pixels for a elements like input and text
+	 *
+	 * @param int $size The abstract size value (1-48)
+	 * @return int Maximum width in pixels
+	 */
+	protected function formMaxWidth($size = 48) {
+		$compensationForLargeDocuments = 1.33;
+		$compensationForFormFields = 12;
+
+		$size = round($size * $compensationForLargeDocuments);
+		return ceil($size * $compensationForFormFields);
+	}
+
+	/**
+	 * Rendering wizards for form fields.
+	 *
+	 * @param array $itemKinds Array with the real item in the first value, and an alternative item in the second value.
+	 * @param array $wizConf The "wizard" key from the config array for the field (from TCA)
+	 * @param string $table Table name
+	 * @param array $row The record array
+	 * @param string $field The field name
+	 * @param array $PA Additional configuration array.
+	 * @param string $itemName The field name
+	 * @param array $specConf Special configuration if available.
+	 * @param bool $RTE Whether the RTE could have been loaded.
+	 * @return string The new item value.
+	 */
+	protected function renderWizards($itemKinds, $wizConf, $table, $row, $field, $PA, $itemName, $specConf, $RTE = FALSE) {
+		// Return not changed main item directly if wizards are disabled
+		if (!is_array($wizConf) || $this->isWizardsDisabled()) {
+			return $itemKinds[0];
+		}
+
+		$languageService = $this->getLanguageService();
+
+		$fieldChangeFunc = $PA['fieldChangeFunc'];
+		$item = $itemKinds[0];
+		$fName = '[' . $table . '][' . $row['uid'] . '][' . $field . ']';
+		$md5ID = 'ID' . GeneralUtility::shortmd5($itemName);
+		$fieldConfig = $PA['fieldConf']['config'];
+		$prefixOfFormElName = 'data[' . $table . '][' . $row['uid'] . '][' . $field . ']';
+		$flexFormPath = '';
+		if (GeneralUtility::isFirstPartOfStr($PA['itemFormElName'], $prefixOfFormElName)) {
+			$flexFormPath = str_replace('][', '/', substr($PA['itemFormElName'], strlen($prefixOfFormElName) + 1, -1));
+		}
+
+		// Manipulate the field name (to be the TRUE form field name) and remove
+		// a suffix-value if the item is a selector box with renderMode "singlebox":
+		$listFlag = '_list';
+		if ($PA['fieldConf']['config']['form_type'] == 'select') {
+			// Single select situation:
+			if ($PA['fieldConf']['config']['maxitems'] <= 1) {
+				$listFlag = '';
+			} elseif ($PA['fieldConf']['config']['renderMode'] == 'singlebox') {
+				$itemName .= '[]';
+				$listFlag = '';
+			}
+		}
+
+		// Contains wizard identifiers enabled for this record type, see "special configuration" docs
+		$wizardsEnabledByType = $specConf['wizards']['parameters'];
+
+		$buttonWizards = array();
+		$otherWizards = array();
+		foreach ($wizConf as $wizardIdentifier => $wizardConfiguration) {
+			// If an identifier starts with "_", this is a configuration option like _POSITION and not a wizard
+			if ($wizardIdentifier[0] === '_') {
+				continue;
+			}
+
+			// Sanitize wizard type
+			$wizardConfiguration['type'] = (string)$wizardConfiguration['type'];
+
+			// Wizards can be shown based on selected "type" of record. If this is the case, the wizard configuration
+			// is set to enableByTypeConfig = 1, and the wizardIdentifier is found in $wizardsEnabledByType
+			$wizardIsEnabled = TRUE;
+			if (
+				isset($wizardConfiguration['enableByTypeConfig'])
+				&& (bool)$wizardConfiguration['enableByTypeConfig']
+				&& (!is_array($wizardsEnabledByType) || !in_array($wizardIdentifier, $wizardsEnabledByType))
+			) {
+				$wizardIsEnabled = FALSE;
+			}
+			// Disable if wizard is for RTE fields only and the handled field is no RTE field or RTE can not be loaded
+			if (isset($wizardConfiguration['RTEonly']) && (bool)$wizardConfiguration['RTEonly'] && !$RTE) {
+				$wizardIsEnabled = FALSE;
+			}
+			// Disable if wizard is for not-new records only and we're handling a new record
+			if (isset($wizardConfiguration['notNewRecords']) && $wizardConfiguration['notNewRecords'] && !MathUtility::canBeInterpretedAsInteger($row['uid'])) {
+				$wizardIsEnabled = FALSE;
+			}
+			// Wizard types script, colorbox and popup must contain a module name configuration
+			if (!isset($wizardConfiguration['module']['name']) && in_array($wizardConfiguration['type'], array('script', 'colorbox', 'popup'), TRUE)) {
+				$wizardIsEnabled = FALSE;
+			}
+
+			if (!$wizardIsEnabled) {
+				continue;
+			}
+
+			// Title / icon:
+			$iTitle = htmlspecialchars($languageService->sL($wizardConfiguration['title']));
+			if (isset($wizardConfiguration['icon'])) {
+				$icon = FormEngineUtility::getIconHtml($wizardConfiguration['icon'], $iTitle, $iTitle);
+			} else {
+				$icon = $iTitle;
+			}
+
+			switch ($wizardConfiguration['type']) {
+				case 'userFunc':
+					$params = array();
+					$params['fieldConfig'] = $fieldConfig;
+					$params['params'] = $wizardConfiguration['params'];
+					$params['exampleImg'] = $wizardConfiguration['exampleImg'];
+					$params['table'] = $table;
+					$params['uid'] = $row['uid'];
+					$params['pid'] = $row['pid'];
+					$params['field'] = $field;
+					$params['flexFormPath'] = $flexFormPath;
+					$params['md5ID'] = $md5ID;
+					$params['returnUrl'] = $this->getReturnUrl();
+
+					$params['formName'] = 'editform';
+					$params['itemName'] = $itemName;
+					$params['hmac'] = GeneralUtility::hmac($params['formName'] . $params['itemName'], 'wizard_js');
+					$params['fieldChangeFunc'] = $fieldChangeFunc;
+					$params['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($fieldChangeFunc));
+
+					$params['item'] = &$item;
+					$params['icon'] = $icon;
+					$params['iTitle'] = $iTitle;
+					$params['wConf'] = $wizardConfiguration;
+					$params['row'] = $row;
+					$formEngineDummy = new FormEngine;
+					$otherWizards[] = GeneralUtility::callUserFunction($wizardConfiguration['userFunc'], $params, $formEngineDummy);
+					break;
+
+				case 'script':
+					$params = array();
+					// Including the full fieldConfig from TCA may produce too long an URL
+					if ($wizardIdentifier != 'RTE') {
+						$params['fieldConfig'] = $fieldConfig;
+					}
+					$params['params'] = $wizardConfiguration['params'];
+					$params['exampleImg'] = $wizardConfiguration['exampleImg'];
+					$params['table'] = $table;
+					$params['uid'] = $row['uid'];
+					$params['pid'] = $row['pid'];
+					$params['field'] = $field;
+					$params['flexFormPath'] = $flexFormPath;
+					$params['md5ID'] = $md5ID;
+					$params['returnUrl'] = $this->getReturnUrl();
+
+					// Resolving script filename and setting URL.
+					$urlParameters = array();
+					if (isset($wizardConfiguration['module']['urlParameters']) && is_array($wizardConfiguration['module']['urlParameters'])) {
+						$urlParameters = $wizardConfiguration['module']['urlParameters'];
+					}
+					$wScript = BackendUtility::getModuleUrl($wizardConfiguration['module']['name'], $urlParameters, '');
+					$url = $wScript . (strstr($wScript, '?') ? '' : '?') . GeneralUtility::implodeArrayForUrl('', array('P' => $params));
+					$buttonWizards[] =
+						'<a class="btn btn-default" href="' . htmlspecialchars($url) . '" onclick="this.blur(); return !TBE_EDITOR.isFormChanged();">'
+							. $icon .
+						'</a>';
+					break;
+
+				case 'popup':
+					$params = array();
+					$params['fieldConfig'] = $fieldConfig;
+					$params['params'] = $wizardConfiguration['params'];
+					$params['exampleImg'] = $wizardConfiguration['exampleImg'];
+					$params['table'] = $table;
+					$params['uid'] = $row['uid'];
+					$params['pid'] = $row['pid'];
+					$params['field'] = $field;
+					$params['flexFormPath'] = $flexFormPath;
+					$params['md5ID'] = $md5ID;
+					$params['returnUrl'] = $this->getReturnUrl();
+
+					$params['formName'] = 'editform';
+					$params['itemName'] = $itemName;
+					$params['hmac'] = GeneralUtility::hmac($params['formName'] . $params['itemName'], 'wizard_js');
+					$params['fieldChangeFunc'] = $fieldChangeFunc;
+					$params['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($fieldChangeFunc));
+
+					// Resolving script filename and setting URL.
+					$urlParameters = array();
+					if (isset($wizardConfiguration['module']['urlParameters']) && is_array($wizardConfiguration['module']['urlParameters'])) {
+						$urlParameters = $wizardConfiguration['module']['urlParameters'];
+					}
+					$wScript = BackendUtility::getModuleUrl($wizardConfiguration['module']['name'], $urlParameters, '');
+					$url = $wScript . (strstr($wScript, '?') ? '' : '?') . GeneralUtility::implodeArrayForUrl('', array('P' => $params));
+
+					$onlyIfSelectedJS = '';
+					if (isset($wizardConfiguration['popup_onlyOpenIfSelected']) && $wizardConfiguration['popup_onlyOpenIfSelected']) {
+						$notSelectedText = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.noSelItemForEdit');
+						$onlyIfSelectedJS =
+							'if (!TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')){' .
+								'alert(' . GeneralUtility::quoteJSvalue($notSelectedText) . ');' .
+								'return false; .
+							}';
+					}
+					$aOnClick =
+						'this.blur();' .
+						$onlyIfSelectedJS .
+						'vHWin=window.open(' .
+							'\'' . $url  . '\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode(' .
+								'document.editform[\'' . $itemName . '\'].value,200' .
+							')' .
+							'+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\'),' .
+							'\'popUp' . $md5ID . '\',' .
+							'\'' . $wizardConfiguration['JSopenParams'] . '\'' .
+						');' .
+						'vHWin.focus();' .
+						'return false;';
+
+					$buttonWizards[] =
+						'<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($aOnClick) . '">' .
+							$icon .
+						'</a>';
+					break;
+
+				case 'colorbox':
+					$params = array();
+					$params['fieldConfig'] = $fieldConfig;
+					$params['params'] = $wizardConfiguration['params'];
+					$params['exampleImg'] = $wizardConfiguration['exampleImg'];
+					$params['table'] = $table;
+					$params['uid'] = $row['uid'];
+					$params['pid'] = $row['pid'];
+					$params['field'] = $field;
+					$params['flexFormPath'] = $flexFormPath;
+					$params['md5ID'] = $md5ID;
+					$params['returnUrl'] = $this->getReturnUrl();
+
+					$params['formName'] = 'editform';
+					$params['itemName'] = $itemName;
+					$params['hmac'] = GeneralUtility::hmac($params['formName'] . $params['itemName'], 'wizard_js');
+					$params['fieldChangeFunc'] = $fieldChangeFunc;
+					$params['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($fieldChangeFunc));
+
+					// Resolving script filename and setting URL.
+					$urlParameters = array();
+					if (isset($wizardConfiguration['module']['urlParameters']) && is_array($wizardConfiguration['module']['urlParameters'])) {
+						$urlParameters = $wizardConfiguration['module']['urlParameters'];
+					}
+					$wScript = BackendUtility::getModuleUrl($wizardConfiguration['module']['name'], $urlParameters, '');
+					$url = $wScript . (strstr($wScript, '?') ? '' : '?') . GeneralUtility::implodeArrayForUrl('', array('P' => $params));
+
+					$aOnClick =
+						'this.blur();' .
+						'vHWin=window.open(' .
+							'\'' . $url  . '\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode(' .
+							'document.editform[\'' . $itemName . '\'].value,200' .
+							')' .
+							'+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\'),' .
+							'\'popUp' . $md5ID . '\',' .
+							'\'' . $wizardConfiguration['JSopenParams'] . '\'' .
+						');' .
+						'vHWin.focus();' .
+						'return false;';
+
+					$dim = GeneralUtility::intExplode('x', $wizardConfiguration['dim']);
+					$dX = MathUtility::forceIntegerInRange($dim[0], 1, 200, 20);
+					$dY = MathUtility::forceIntegerInRange($dim[1], 1, 200, 20);
+					$color = $PA['itemFormElValue'] ? ' bgcolor="' . htmlspecialchars($PA['itemFormElValue']) . '"' : '';
+					$skinImg = IconUtility::skinImg(
+						'',
+						$PA['itemFormElValue'] === '' ? 'gfx/colorpicker_empty.png' : 'gfx/colorpicker.png',
+						'width="' . $dX . '" height="' . $dY . '"' . BackendUtility::titleAltAttrib(trim($iTitle . ' ' . $PA['itemFormElValue'])) . ' border="0"'
+					);
+					$otherWizards[] =
+						'<table border="0" id="' . $md5ID . '"' . $color . ' style="' . htmlspecialchars($wizardConfiguration['tableStyle']) . '">' .
+							'<tr>' .
+								'<td>' .
+									'<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img ' . $skinImg . '>' . '</a>' .
+								'</td>' .
+							'</tr>' .
+						'</table>';
+					break;
+
+				case 'slider':
+					$params = array();
+					$params['fieldConfig'] = $fieldConfig;
+					$params['field'] = $field;
+					$params['flexFormPath'] = $flexFormPath;
+					$params['md5ID'] = $md5ID;
+					$params['itemName'] = $itemName;
+					$params['fieldChangeFunc'] = $fieldChangeFunc;
+					$params['wConf'] = $wizardConfiguration;
+					$params['row'] = $row;
+
+					/** @var ValueSliderWizard $wizard */
+					$wizard = GeneralUtility::makeInstance(ValueSliderWizard::class);
+					$otherWizards[] = $wizard->renderWizard($params);
+					break;
+
+				case 'select':
+					$fieldValue = array('config' => $wizardConfiguration);
+					$TSconfig = FormEngineUtility::getTSconfigForTableRow($table, $row);
+					$TSconfig[$field] = $TSconfig[$field]['wizards.'][$wizardIdentifier . '.'];
+					$selItems = FormEngineUtility::addSelectOptionsToItemArray(FormEngineUtility::initItemArray($fieldValue), $fieldValue, $TSconfig, $field);
+					// Process items by a user function:
+					if (!empty($wizardConfiguration['itemsProcFunc'])) {
+						$funcConfig = !empty($wizardConfiguration['itemsProcFunc.']) ? $wizardConfiguration['itemsProcFunc.'] : array();
+						$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+						$selItems = $dataPreprocessor->procItems($selItems, $funcConfig, $wizardConfiguration, $table, $row, $field);
+					}
+					$options = array();
+					$options[] = '<option>' . $iTitle . '</option>';
+					foreach ($selItems as $p) {
+						$options[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>';
+					}
+					if ($wizardConfiguration['mode'] == 'append') {
+						$assignValue = 'document.editform[\'' . $itemName . '\'].value=\'\'+this.options[this.selectedIndex].value+document.editform[\'' . $itemName . '\'].value';
+					} elseif ($wizardConfiguration['mode'] == 'prepend') {
+						$assignValue = 'document.editform[\'' . $itemName . '\'].value+=\'\'+this.options[this.selectedIndex].value';
+					} else {
+						$assignValue = 'document.editform[\'' . $itemName . '\'].value=this.options[this.selectedIndex].value';
+					}
+					$otherWizards[] =
+						'<select' .
+							' id="' . str_replace('.', '', uniqid('tceforms-select-', TRUE)) . '"' .
+							' class="form-control tceforms-select tceforms-wizardselect"' .
+							' name="_WIZARD' . $fName . '"' .
+							' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"'.
+						'>' .
+							implode('', $options) .
+						'</select>';
+					break;
+				case 'suggest':
+					if (!empty($PA['fieldTSConfig']['suggest.']['default.']['hide'])) {
+						break;
+					}
+					/** @var SuggestWizard $suggestWizard */
+					$suggestWizard = GeneralUtility::makeInstance(SuggestWizard::class);
+					$otherWizards[] = $suggestWizard->renderSuggestSelector($PA['itemFormElName'], $table, $field, $row, $PA);
+					break;
+			}
+
+			// Hide the real form element?
+			if (is_array($wizardConfiguration['hideParent']) || $wizardConfiguration['hideParent']) {
+				// Setting the item to a hidden-field.
+				$item = $itemKinds[1];
+				if (is_array($wizardConfiguration['hideParent'])) {
+					// NoneElement does not access formEngine properties, use a dummy for decoupling
+					$formEngineDummy = new FormEngine;
+					/** @var NoneElement $noneElement */
+					$noneElement = GeneralUtility::makeInstance(NoneElement::class, $formEngineDummy);
+					$elementConfiguration = array(
+						'fieldConf' => array(
+							'config' => $wizardConfiguration['hideParent'],
+						),
+						'itemFormElValue' => $PA['itemFormElValue'],
+					);
+					$item .= $noneElement->render('', '', '', $elementConfiguration);
+				}
+			}
+		}
+
+		// For each rendered wizard, put them together around the item.
+		if (!empty($buttonWizards) || !empty($otherWizards)) {
+			if ($wizConf['_HIDDENFIELD']) {
+				$item = $itemKinds[1];
+			}
+
+			$innerContent = '';
+			if (!empty($buttonWizards)) {
+				$innerContent .= '<div class="btn-group' . ($wizConf['_VERTICAL'] ? ' btn-group-vertical' : '') . '">' . implode('', $buttonWizards) . '</div>';
+			}
+			$innerContent .= implode(' ', $otherWizards);
+
+			// Position
+			$classes = array('form-wizards-wrap');
+			if ($wizConf['_POSITION'] === 'left') {
+				$classes[] = 'form-wizards-aside';
+				$innerContent = '<div class="form-wizards-items">' . $innerContent . '</div><div class="form-wizards-element">' . $item . '</div>';
+			} elseif ($wizConf['_POSITION'] === 'top') {
+				$classes[] = 'form-wizards-top';
+				$innerContent = '<div class="form-wizards-items">' . $innerContent . '</div><div class="form-wizards-element">' . $item . '</div>';
+			} elseif ($wizConf['_POSITION'] === 'bottom') {
+				$classes[] = 'form-wizards-bottom';
+				$innerContent = '<div class="form-wizards-element">' . $item . '</div><div class="form-wizards-items">' . $innerContent . '</div>';
+			} else {
+				$classes[] = 'form-wizards-aside';
+				$innerContent = '<div class="form-wizards-element">' . $item . '</div><div class="form-wizards-items">' . $innerContent . '</div>';
+			}
+			$item = '
+				<div class="' . implode(' ', $classes) . '">
+					' . $innerContent . '
+				</div>';
+		}
+
+		return $item;
+	}
+
+	/**
+	 * Prints the selector box form-field for the db/file/select elements (multiple)
+	 *
+	 * @param string $fName Form element name
+	 * @param string $mode Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type)
+	 * @param string $allowed Commalist of "allowed
+	 * @param array $itemArray The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs.
+	 * @param string $selector Alternative selector box.
+	 * @param array $params An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails
+	 * @param string $onFocus On focus attribute string
+	 * @param string $table (optional) Table name processing for
+	 * @param string $field (optional) Field of table name processing for
+	 * @param string $uid (optional) uid of table record processing for
+	 * @param array $config (optional) The TCA field config
+	 * @return string The form fields for the selection.
+	 * @throws \UnexpectedValueException
+	 */
+	protected function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $table = '', $field = '', $uid = '', $config = array()) {
+		$languageService = $this->getLanguageService();
+		$disabled = '';
+		if ($this->isGlobalReadonly() || $params['readOnly']) {
+			$disabled = ' disabled="disabled"';
+		}
+		// INIT
+		$uidList = array();
+		$opt = array();
+		$itemArrayC = 0;
+		// Creating <option> elements:
+		if (is_array($itemArray)) {
+			$itemArrayC = count($itemArray);
+			switch ($mode) {
+				case 'db':
+					foreach ($itemArray as $pp) {
+						$pRec = BackendUtility::getRecordWSOL($pp['table'], $pp['id']);
+						if (is_array($pRec)) {
+							$pTitle = BackendUtility::getRecordTitle($pp['table'], $pRec, FALSE, TRUE);
+							$pUid = $pp['table'] . '_' . $pp['id'];
+							$uidList[] = $pUid;
+							$title = htmlspecialchars($pTitle);
+							$opt[] = '<option value="' . htmlspecialchars($pUid) . '" title="' . $title . '">' . $title . '</option>';
+						}
+					}
+					break;
+				case 'file_reference':
+
+				case 'file':
+					foreach ($itemArray as $item) {
+						$itemParts = explode('|', $item);
+						$uidList[] = ($pUid = ($pTitle = $itemParts[0]));
+						$title = htmlspecialchars(rawurldecode($itemParts[1]));
+						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($itemParts[0])) . '" title="' . $title . '">' . $title . '</option>';
+					}
+					break;
+				case 'folder':
+					foreach ($itemArray as $pp) {
+						$pParts = explode('|', $pp);
+						$uidList[] = ($pUid = ($pTitle = $pParts[0]));
+						$title = htmlspecialchars(rawurldecode($pParts[0]));
+						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '" title="' . $title . '">' . $title . '</option>';
+					}
+					break;
+				default:
+					foreach ($itemArray as $pp) {
+						$pParts = explode('|', $pp, 2);
+						$uidList[] = ($pUid = $pParts[0]);
+						$pTitle = $pParts[1];
+						$title = htmlspecialchars(rawurldecode($pTitle));
+						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '" title="' . $title . '">' . $title . '</option>';
+					}
+			}
+		}
+		// Create selector box of the options
+		$sSize = $params['autoSizeMax']
+			? MathUtility::forceIntegerInRange($itemArrayC + 1, MathUtility::forceIntegerInRange($params['size'], 1), $params['autoSizeMax'])
+			: $params['size'];
+		if (!$selector) {
+			$isMultiple = $params['maxitems'] != 1 && $params['size'] != 1;
+			$selector = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE)) . '" '
+				. ($params['noList'] ? 'style="display: none"' : 'size="' . $sSize . '" class="form-control tceforms-multiselect"')
+				. ($isMultiple ? ' multiple="multiple"' : '')
+				. ' name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt)
+				. '</select>';
+		}
+		$icons = array(
+			'L' => array(),
+			'R' => array()
+		);
+		$rOnClickInline = '';
+		if (!$params['readOnly'] && !$params['noList']) {
+			if (!$params['noBrowser']) {
+				// Check against inline uniqueness
+				/** @var InlineElement $inline */
+				$inline = $this->globalOptions['inline'];
+				$inlineParent = $inline->getStructureLevel(-1);
+				$aOnClickInline = '';
+				if (is_array($inlineParent) && $inlineParent['uid']) {
+					if ($inlineParent['config']['foreign_table'] == $table && $inlineParent['config']['foreign_unique'] == $field) {
+						$objectPrefix = $inline->inlineNames['object'] . InlineElement::Structure_Separator . $table;
+						$aOnClickInline = $objectPrefix . '|inline.checkUniqueElement|inline.setUniqueElement';
+						$rOnClickInline = 'inline.revertUnique(\'' . $objectPrefix . '\',null,\'' . $uid . '\');';
+					}
+				}
+				if (is_array($config['appearance']) && isset($config['appearance']['elementBrowserType'])) {
+					$elementBrowserType = $config['appearance']['elementBrowserType'];
+				} else {
+					$elementBrowserType = $mode;
+				}
+				if (is_array($config['appearance']) && isset($config['appearance']['elementBrowserAllowed'])) {
+					$elementBrowserAllowed = $config['appearance']['elementBrowserAllowed'];
+				} else {
+					$elementBrowserAllowed = $allowed;
+				}
+				$aOnClick = 'setFormValueOpenBrowser(\'' . $elementBrowserType . '\',\''
+					. ($fName . '|||' . $elementBrowserAllowed . '|' . $aOnClickInline) . '\'); return false;';
+				$icons['R'][] = '
+					<a href="#"
+						onclick="' . htmlspecialchars($aOnClick) . '"
+						class="btn btn-default"
+						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.browse_' . ($mode == 'db' ? 'db' : 'file'))) . '">
+						' . IconUtility::getSpriteIcon('actions-insert-record') . '
+					</a>';
+			}
+			if (!$params['dontShowMoveIcons']) {
+				if ($sSize >= 5) {
+					$icons['L'][] = '
+						<a href="#"
+							class="btn btn-default t3-btn-moveoption-top"
+							data-fieldname="' . $fName . '"
+							title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_top')) . '">
+							' . IconUtility::getSpriteIcon('actions-move-to-top') . '
+						</a>';
+
+				}
+				$icons['L'][] = '
+					<a href="#"
+						class="btn btn-default t3-btn-moveoption-up"
+						data-fieldname="' . $fName . '"
+						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_up')) . '">
+						' . IconUtility::getSpriteIcon('actions-move-up') . '
+					</a>';
+				$icons['L'][] = '
+					<a href="#"
+						class="btn btn-default t3-btn-moveoption-down"
+						data-fieldname="' . $fName . '"
+						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_down')) . '">
+						' . IconUtility::getSpriteIcon('actions-move-down') . '
+					</a>';
+				if ($sSize >= 5) {
+					$icons['L'][] = '
+						<a href="#"
+							class="btn btn-default t3-btn-moveoption-bottom"
+							data-fieldname="' . $fName . '"
+							title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_bottom')) . '">
+							' . IconUtility::getSpriteIcon('actions-move-to-bottom') . '
+						</a>';
+				}
+			}
+			$clipElements = $this->getClipboardElements($allowed, $mode);
+			if (count($clipElements)) {
+				$aOnClick = '';
+				foreach ($clipElements as $elValue) {
+					if ($mode == 'db') {
+						list($itemTable, $itemUid) = explode('|', $elValue);
+						$recordTitle = BackendUtility::getRecordTitle($itemTable, BackendUtility::getRecordWSOL($itemTable, $itemUid));
+						$itemTitle = GeneralUtility::quoteJSvalue($recordTitle);
+						$elValue = $itemTable . '_' . $itemUid;
+					} else {
+						// 'file', 'file_reference' and 'folder' mode
+						$itemTitle = 'unescape(\'' . rawurlencode(basename($elValue)) . '\')';
+					}
+					$aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',unescape(\''
+						. rawurlencode(str_replace('%20', ' ', $elValue)) . '\'),' . $itemTitle . ',' . $itemTitle . ');';
+				}
+				$aOnClick .= 'return false;';
+				$icons['R'][] = '
+					<a href="#"
+						onclick="' . htmlspecialchars($aOnClick) . '"
+						title="' . htmlspecialchars(sprintf($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))) . '">
+						' . IconUtility::getSpriteIcon('actions-document-paste-into') . '
+					</a>';
+			}
+		}
+		if (!$params['readOnly'] && !$params['noDelete']) {
+			$icons['L'][] = '
+				<a href="#"
+					class="btn btn-default t3-btn-removeoption"
+					onClick="' . $rOnClickInline . '"
+					data-fieldname="' . $fName . '"
+					title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.remove_selected')) . '">
+					' . IconUtility::getSpriteIcon('actions-selection-delete') . '
+				</a>';
+		}
+
+		// Thumbnails
+		$imagesOnly = FALSE;
+		if ($params['thumbnails'] && $params['allowed']) {
+			// In case we have thumbnails, check if only images are allowed.
+			// In this case, render them below the field, instead of to the right
+			$allowedExtensionList = $params['allowed'];
+			$imageExtensionList = GeneralUtility::trimExplode(',', strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), TRUE);
+			$imagesOnly = TRUE;
+			foreach ($allowedExtensionList as $allowedExtension) {
+				if (!ArrayUtility::inArray($imageExtensionList, $allowedExtension)) {
+					$imagesOnly = FALSE;
+					break;
+				}
+			}
+		}
+		$thumbnails = '';
+		if (is_array($params['thumbnails']) && !empty($params['thumbnails'])) {
+			if ($imagesOnly) {
+				$thumbnails .= '<ul class="list-inline">';
+				foreach ($params['thumbnails'] as $thumbnail) {
+					$thumbnails .= '<li><span class="thumbnail">' . $thumbnail['image'] . '</span></li>';
+				}
+				$thumbnails .= '</ul>';
+			} else {
+				$thumbnails .= '<div class="table-fit"><table class="table table-white"><tbody>';
+				foreach ($params['thumbnails'] as $thumbnail) {
+					$thumbnails .= '
+						<tr>
+							<td class="col-icon">
+								' . ($config['internal_type'] === 'db'
+							? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($thumbnail['image'], $thumbnail['table'], $thumbnail['uid'], 1, '', '+copy,info,edit,view')
+							: $thumbnail['image']) . '
+							</td>
+							<td class="col-title">
+								' . ($config['internal_type'] === 'db'
+							? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($thumbnail['name'], $thumbnail['table'], $thumbnail['uid'], 1, '', '+copy,info,edit,view')
+							: $thumbnail['name']) . '
+								' . ($config['internal_type'] === 'db' ? '' : ' <span class="text-muted">[' . $thumbnail['uid'] . ']</span>') . '
+							</td>
+						</tr>
+						';
+				}
+				$thumbnails .= '</tbody></table></div>';
+			}
+		}
+
+		// Allowed Tables
+		$allowedTables = '';
+		if (is_array($params['allowedTables']) && !empty($params['allowedTables'])) {
+			$allowedTables .= '<div class="help-block">';
+			foreach ($params['allowedTables'] as $key => $item) {
+				if (is_array($item)) {
+					$allowedTables .= '<a href="#" onClick="' . htmlspecialchars($item['onClick']) . '" class="btn btn-default">' . $item['icon'] . ' ' . htmlspecialchars($item['name']) . '</a> ';
+				} elseif($key === 'name') {
+					$allowedTables .= '<span>' . htmlspecialchars($item) . '</span> ';
+				}
+			}
+			$allowedTables .= '</div>';
+		}
+		// Allowed
+		$allowedList = '';
+		if (is_array($params['allowed']) && !empty($params['allowed'])) {
+			foreach ($params['allowed'] as $item) {
+				$allowedList .= '<span class="label label-success">' . strtoupper($item) . '</span> ';
+			}
+		}
+		// Disallowed
+		$disallowedList = '';
+		if (is_array($params['disallowed']) && !empty($params['disallowed'])) {
+			foreach ($params['disallowed'] as $item) {
+				$disallowedList .= '<span class="label label-danger">' . strtoupper($item) . '</span> ';
+			}
+		}
+		// Rightbox
+		$rightbox = ($params['rightbox'] ?: '');
+
+		// Hook: dbFileIcons_postProcess (requested by FAL-team for use with the "fal" extension)
+		if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'])) {
+			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'] as $classRef) {
+				$hookObject = GeneralUtility::getUserObj($classRef);
+				if (!$hookObject instanceof DatabaseFileIconsHookInterface) {
+					throw new \UnexpectedValueException('$hookObject must implement interface ' . DatabaseFileIconsHookInterface::class, 1290167704);
+				}
+				$additionalParams = array(
+					'mode' => $mode,
+					'allowed' => $allowed,
+					'itemArray' => $itemArray,
+					'onFocus' => $onFocus,
+					'table' => $table,
+					'field' => $field,
+					'uid' => $uid,
+					'config' => $GLOBALS['TCA'][$table]['columns'][$field]
+				);
+				$hookObject->dbFileIcons_postProcess($params, $selector, $thumbnails, $icons, $rightbox, $fName, $uidList, $additionalParams, $this);
+			}
+		}
+
+		// Output
+		$str = '
+			' . ($params['headers']['selector'] ? '<label>' . $params['headers']['selector'] . '</label>' : '') . '
+			<div class="form-wizards-wrap form-wizards-aside">
+				<div class="form-wizards-element">
+					' . $selector . '
+					' . (!$params['noList'] && !empty($allowedTables) ? $allowedTables : '') . '
+					' . (!$params['noList'] && (!empty($allowedList) || !empty($disallowedList))
+				? '<div class="help-block">' . $allowedList . $disallowedList . ' </div>'
+				: '') . '
+				</div>
+				' . (!empty($icons['L']) ? '<div class="form-wizards-items"><div class="btn-group-vertical">' . implode('', $icons['L']) . '</div></div>' : '' ) . '
+				' . (!empty($icons['R']) ? '<div class="form-wizards-items"><div class="btn-group-vertical">' . implode('', $icons['R']) . '</div></div>' : '' ) . '
+			</div>
+			';
+		if ($rightbox) {
+			$str = '
+				<div class="form-multigroup-wrap t3js-formengine-field-group">
+					<div class="form-multigroup-item form-multigroup-element">' . $str . '</div>
+					<div class="form-multigroup-item form-multigroup-element">
+						' . ($params['headers']['items'] ? '<label>' . $params['headers']['items'] . '</label>' : '') . '
+						' . ($params['headers']['selectorbox'] ? '<div class="form-multigroup-item-wizard">' . $params['headers']['selectorbox'] . '</div>' : '') . '
+						' . $rightbox . '
+					</div>
+				</div>
+				';
+		}
+		$str .= $thumbnails;
+
+		// Creating the hidden field which contains the actual value as a comma list.
+		$str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />';
+		return $str;
+	}
+
+	/**
+	 * Returns array of elements from clipboard to insert into GROUP element box.
+	 *
+	 * @param string $allowed Allowed elements, Eg "pages,tt_content", "gif,jpg,jpeg,png
+	 * @param string $mode Mode of relations: "db" or "file
+	 * @return array Array of elements in values (keys are insignificant), if none found, empty array.
+	 */
+	protected function getClipboardElements($allowed, $mode) {
+		if (!is_object($this->clipboard)) {
+			$this->clipboard = GeneralUtility::makeInstance(Clipboard::class);
+			$this->clipboard->initializeClipboard();
+		}
+
+		$output = array();
+		switch ($mode) {
+			case 'file_reference':
+
+			case 'file':
+				$elFromTable = $this->clipboard->elFromTable('_FILE');
+				$allowedExts = GeneralUtility::trimExplode(',', $allowed, TRUE);
+				// If there are a set of allowed extensions, filter the content:
+				if ($allowedExts) {
+					foreach ($elFromTable as $elValue) {
+						$pI = pathinfo($elValue);
+						$ext = strtolower($pI['extension']);
+						if (in_array($ext, $allowedExts)) {
+							$output[] = $elValue;
+						}
+					}
+				} else {
+					// If all is allowed, insert all: (This does NOT respect any disallowed extensions,
+					// but those will be filtered away by the backend TCEmain)
+					$output = $elFromTable;
+				}
+				break;
+			case 'db':
+				$allowedTables = GeneralUtility::trimExplode(',', $allowed, TRUE);
+				// All tables allowed for relation:
+				if (trim($allowedTables[0]) === '*') {
+					$output = $this->clipboard->elFromTable('');
+				} else {
+					// Only some tables, filter them:
+					foreach ($allowedTables as $tablename) {
+						$elFromTable = $this->clipboard->elFromTable($tablename);
+						$output = array_merge($output, $elFromTable);
+					}
+				}
+				$output = array_keys($output);
+				break;
+		}
+
+		return $output;
+	}
+
 	/**
 	 * @return LanguageService
 	 */
diff --git a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php
index 94f9ff21cc41c9e55037cd13f3adb048a3b344b5..c8bde246011bdfff96f4a8596824f1ff489f7211 100644
--- a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
+
 /**
  * Generation of TCEform elements of the type "check"
  */
@@ -32,13 +36,14 @@ class CheckboxElement extends AbstractFormElement {
 		$config = $additionalInformation['fieldConf']['config'];
 		$item = '';
 		$disabled = FALSE;
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = TRUE;
 		}
 		// Traversing the array of items
-		$items = $this->formEngine->initItemArray($additionalInformation['fieldConf']);
+		$items = FormEngineUtility::initItemArray($additionalInformation['fieldConf']);
 		if ($config['itemsProcFunc']) {
-			$items = $this->formEngine->procItems(
+			$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+			$items = $dataPreprocessor->procItems(
 				$items,
 				$additionalInformation['fieldTSConfig']['itemsProcFunc.'],
 				$config,
@@ -180,7 +185,7 @@ class CheckboxElement extends AbstractFormElement {
 	 * @return string The onclick attribute + possibly the checked-option set.
 	 */
 	protected function checkBoxParams($itemName, $formElementValue, $checkbox, $checkboxesCount, $additionalJavaScript = '') {
-		$elementName = $this->formEngine->elName($itemName);
+		$elementName = 'document.editform[' . Generalutility::quoteJSvalue($itemName) . ']';
 		$checkboxPow = pow(2, $checkbox);
 		$onClick = $elementName . '.value=this.checked?(' . $elementName . '.value|' . $checkboxPow . '):('
 			. $elementName . '.value&' . (pow(2, $checkboxesCount) - 1 - $checkboxPow) . ');' . $additionalJavaScript;
diff --git a/typo3/sysext/backend/Classes/Form/Element/FlexElement.php b/typo3/sysext/backend/Classes/Form/Element/FlexElement.php
index d8f44fbd714ac7a03df0a66c846777aa72ab3ed1..665751444614bc32f81d80ca01e4642e427f16e6 100644
--- a/typo3/sysext/backend/Classes/Form/Element/FlexElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/FlexElement.php
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
@@ -112,7 +113,7 @@ class FlexElement extends AbstractFormElement {
 
 			foreach ($rotateLang as $lKey) {
 				if (!$langChildren && !$langDisabled) {
-					$item .= '<strong>' . $this->formEngine->getLanguageIcon($table, $row, ('v' . $lKey)) . $lKey . ':</strong>';
+					$item .= '<strong>' . FormEngineUtility::getLanguageIcon($table, $row, ('v' . $lKey)) . $lKey . ':</strong>';
 				}
 				// Default language, other options are "lUK" or whatever country code (independent of system!!!)
 				$lang = 'l' . $lKey;
@@ -510,7 +511,7 @@ class FlexElement extends AbstractFormElement {
 								$theTitle = htmlspecialchars($fakePA['fieldConf']['label']);
 								if (!in_array('DEF', $rotateLang)) {
 									$defInfo = '<div class="t3-form-original-language">'
-										. $this->formEngine->getLanguageIcon($table, $row, 0)
+										. FormEngineUtility::getLanguageIcon($table, $row, 0)
 										. $this->formEngine->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field)
 										. '&nbsp;</div>';
 								} else {
@@ -520,14 +521,14 @@ class FlexElement extends AbstractFormElement {
 									$prLang = $this->formEngine->getAdditionalPreviewLanguages();
 									foreach ($prLang as $prL) {
 										$defInfo .= '<div class="t3-form-original-language">'
-											. $this->formEngine->getLanguageIcon($table, $row, ('v' . $prL['ISOcode']))
+											. FormEngineUtility::getLanguageIcon($table, $row, ('v' . $prL['ISOcode']))
 											. $this->formEngine->previewFieldValue($editData[$key][('v' . $prL['ISOcode'])], $fakePA['fieldConf'], $field)
 											. '&nbsp;</div>';
 									}
 								}
 								$languageIcon = '';
 								if ($vDEFkey != 'vDEF') {
-									$languageIcon = $this->formEngine->getLanguageIcon($table, $row, $vDEFkey);
+									$languageIcon = FormEngineUtility::getLanguageIcon($table, $row, $vDEFkey);
 								}
 								// Put row together
 								// possible linebreaks in the label through xml: \n => <br/>, usage of nl2br()
diff --git a/typo3/sysext/backend/Classes/Form/Element/GroupElement.php b/typo3/sysext/backend/Classes/Form/Element/GroupElement.php
index 2fac40969f5096afa63ea3c1ecaa303b03403ee3..007b428d95049a47f4c67e75a1b8dfd5adb15813 100644
--- a/typo3/sysext/backend/Classes/Form/Element/GroupElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/GroupElement.php
@@ -41,7 +41,7 @@ class GroupElement extends AbstractFormElement {
 
 		$config = $additionalInformation['fieldConf']['config'];
 		$show_thumbs = $config['show_thumbs'];
-		$size = isset($config['size']) ? (int)$config['size'] : $this->formEngine->minimumInputWidth;
+		$size = isset($config['size']) ? (int)$config['size'] : $this->minimumInputWidth;
 		$maxitems = MathUtility::forceIntegerInRange($config['maxitems'], 0);
 		if (!$maxitems) {
 			$maxitems = 100000;
@@ -50,7 +50,7 @@ class GroupElement extends AbstractFormElement {
 		$thumbnails = array();
 		$allowed = GeneralUtility::trimExplode(',', $config['allowed'], TRUE);
 		$disallowed = GeneralUtility::trimExplode(',', $config['disallowed'], TRUE);
-		$disabled = ($this->isRenderReadonly() || $config['readOnly']);
+		$disabled = ($this->isGlobalReadonly() || $config['readOnly']);
 		$info = array();
 		$additionalInformation['itemFormElID_file'] = $additionalInformation['itemFormElID'] . '_files';
 
@@ -144,7 +144,7 @@ class GroupElement extends AbstractFormElement {
 										$rowCopy,
 										$table,
 										$field,
-										$this->formEngine->backPath,
+										'',
 										'thumbs.php',
 										$config['uploadfolder'],
 										0,
@@ -178,14 +178,14 @@ class GroupElement extends AbstractFormElement {
 					'maxitems' => $maxitems,
 					'style' => isset($config['selectedListStyle'])
 						? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
-						: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
+						: '',
 					'thumbnails' => $thumbnails,
 					'readOnly' => $disabled,
 					'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
 					'noList' => $noList,
 					'noDelete' => $noDelete
 				);
-				$item .= $this->formEngine->dbFileIcons(
+				$item .= $this->dbFileIcons(
 					$additionalInformation['itemFormElName'],
 					'file',
 					implode(',', $allowed),
@@ -199,7 +199,8 @@ class GroupElement extends AbstractFormElement {
 					$config);
 				if (!$disabled && !(isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'upload'))) {
 					// Adding the upload field:
-					if ($this->formEngine->edit_docModuleUpload && $config['uploadfolder']) {
+					$isDirectFileUploadEnabled = (bool)$this->getBackendUserAuthentication()->uc['edit_docModuleUpload'];
+					if ($isDirectFileUploadEnabled && $config['uploadfolder']) {
 						// Insert the multiple attribute to enable HTML5 multiple file upload
 						$multipleAttribute = '';
 						$multipleFilenameSuffix = '';
@@ -229,12 +230,12 @@ class GroupElement extends AbstractFormElement {
 					'maxitems' => $maxitems,
 					'style' => isset($config['selectedListStyle'])
 						? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
-						: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
+						: '',
 					'readOnly' => $disabled,
 					'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
 					'noList' => $noList
 				);
-				$item .= $this->formEngine->dbFileIcons(
+				$item .= $this->dbFileIcons(
 					$additionalInformation['itemFormElName'],
 					'folder',
 					'',
@@ -298,7 +299,7 @@ class GroupElement extends AbstractFormElement {
 					'maxitems' => $maxitems,
 					'style' => isset($config['selectedListStyle'])
 						? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
-						: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
+						: '',
 					'info' => $info,
 					'allowedTables' => $allowedTables,
 					'thumbnails' => $thumbnails,
@@ -306,7 +307,7 @@ class GroupElement extends AbstractFormElement {
 					'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
 					'noList' => $noList
 				);
-				$item .= $this->formEngine->dbFileIcons(
+				$item .= $this->dbFileIcons(
 					$additionalInformation['itemFormElName'],
 					'db',
 					implode(',', $allowed),
@@ -324,7 +325,7 @@ class GroupElement extends AbstractFormElement {
 		// Wizards:
 		$altItem = '<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '" value="' . htmlspecialchars($additionalInformation['itemFormElValue']) . '" />';
 		if (!$disabled) {
-			$item = $this->formEngine->renderWizards(
+			$item = $this->renderWizards(
 				array(
 					$item,
 					$altItem
diff --git a/typo3/sysext/backend/Classes/Form/Element/InlineElement.php b/typo3/sysext/backend/Classes/Form/Element/InlineElement.php
index 12a8181b527324fe17f25121e84abbe4bab7f183..cf15b30466b1d9c559ada3e00d95eb9473772f8c 100644
--- a/typo3/sysext/backend/Classes/Form/Element/InlineElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/InlineElement.php
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
@@ -24,6 +25,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
 use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 
 /**
  * The Inline-Relational-Record-Editing (IRRE) functions as part of the FormEngine.
@@ -47,14 +50,15 @@ class InlineElement {
 	 *
 	 * @var \TYPO3\CMS\Backend\Form\FormEngine
 	 */
-	public $fObj;
+	protected $formEngine;
 
 	/**
-	 * Reference to $fObj->backPath
+	 * Reference to $formEngine->backPath
 	 *
 	 * @var string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public $backPath;
+	public $backPath = '';
 
 	/**
 	 * Indicates if a field is rendered upon an AJAX call
@@ -145,10 +149,9 @@ class InlineElement {
 	 * @return void
 	 */
 	public function init(&$formEngine) {
-		$this->fObj = $formEngine;
-		$this->backPath = &$formEngine->backPath;
-		$this->prependFormFieldNames = &$this->fObj->prependFormFieldNames;
-		$this->prependCmdFieldNames = &$this->fObj->prependCmdFieldNames;
+		$this->formEngine = $formEngine;
+		$this->prependFormFieldNames = &$this->formEngine->prependFormFieldNames;
+		$this->prependCmdFieldNames = &$this->formEngine->prependCmdFieldNames;
 		$this->inlineStyles['margin-right'] = '5';
 		$this->initHookObjects();
 	}
@@ -209,7 +212,7 @@ class InlineElement {
 			$maxitems = 100000;
 		}
 		// Register the required number of elements:
-		$this->fObj->requiredElements[$PA['itemFormElName']] = array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field);
+		$this->formEngine->requiredElements[$PA['itemFormElName']] = array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field);
 		// Remember the page id (pid of record) where inline editing started first
 		// We need that pid for ajax calls, so that they would know where the action takes place on the page structure
 		if (!isset($this->inlineFirstPid)) {
@@ -262,7 +265,7 @@ class InlineElement {
 			),
 		);
 		// Set a hint for nested IRRE and tab elements:
-		$this->inlineData['nested'][$nameObject] = $this->fObj->getDynNestedStack(FALSE, $this->isAjaxCall);
+		$this->inlineData['nested'][$nameObject] = $this->formEngine->getDynNestedStack(FALSE, $this->isAjaxCall);
 		// If relations are required to be unique, get the uids that have already been used on the foreign side of the relation
 		if ($config['foreign_unique']) {
 			// If uniqueness *and* selector are set, they should point to the same field - so, get the configuration of one:
@@ -385,7 +388,7 @@ class InlineElement {
 		// Register default localization content:
 		$parent = $this->getStructureLevel(-1);
 		if (isset($parent['localizationMode']) && $parent['localizationMode'] != FALSE) {
-			$this->fObj->registerDefaultLanguageData($foreign_table, $rec);
+			$this->formEngine->registerDefaultLanguageData($foreign_table, $rec);
 		}
 		// Send a mapping information to the browser via JSON:
 		// e.g. data[<curTable>][<curId>][<curField>] => data-<pid>-<parentTable>-<parentId>-<parentField>-<curTable>-<curId>-<curField>
@@ -406,7 +409,7 @@ class InlineElement {
 		$appendFormFieldNames = '[' . $foreign_table . '][' . $rec['uid'] . ']';
 		$objectId = $nameObject . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid'];
 		// Put the current level also to the dynNestedStack of FormEngine:
-		$this->fObj->pushToDynNestedStack('inline', $objectId);
+		$this->formEngine->pushToDynNestedStack('inline', $objectId);
 		$class = '';
 		if (!$isVirtualRecord) {
 			// Get configuration:
@@ -483,7 +486,7 @@ class InlineElement {
 				</div>';
 		}
 		// Remove the current level also from the dynNestedStack of FormEngine:
-		$this->fObj->popFromDynNestedStack();
+		$this->formEngine->popFromDynNestedStack();
 		return $out;
 	}
 
@@ -497,16 +500,16 @@ class InlineElement {
 	 */
 	protected function renderMainFields($table, array $row, array $overruleTypesArray = array()) {
 		// The current render depth of \TYPO3\CMS\Backend\Form\FormEngine
-		$depth = $this->fObj->renderDepth;
+		$depth = $this->formEngine->renderDepth;
 		// If there is some information about already rendered palettes of our parent, store this info:
-		if (isset($this->fObj->palettesRendered[$depth][$table])) {
-			$palettesRendered = $this->fObj->palettesRendered[$depth][$table];
+		if (isset($this->formEngine->palettesRendered[$depth][$table])) {
+			$palettesRendered = $this->formEngine->palettesRendered[$depth][$table];
 		}
 		// Render the form:
-		$content = $this->fObj->getMainFields($table, $row, $depth, $overruleTypesArray);
+		$content = $this->formEngine->getMainFields($table, $row, $depth, $overruleTypesArray);
 		// If there was some info about rendered palettes stored, write it back for our parent:
 		if (isset($palettesRendered)) {
-			$this->fObj->palettesRendered[$depth][$table] = $palettesRendered;
+			$this->formEngine->palettesRendered[$depth][$table] = $palettesRendered;
 		}
 		return $content;
 	}
@@ -887,7 +890,7 @@ class InlineElement {
 		$PA['fieldConf'] = $GLOBALS['TCA'][$foreign_table]['columns'][$foreign_selector];
 		$PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ?: $PA['fieldConf']['config']['type'];
 		// Using "form_type" locally in this script
-		$PA['fieldTSConfig'] = $this->fObj->setTSconfig($foreign_table, array(), $foreign_selector);
+		$PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($foreign_table, array(), $foreign_selector);
 		$config = $PA['fieldConf']['config'];
 		// @todo $disabled is not present - should be read from config?
 		$disabled = FALSE;
@@ -897,14 +900,14 @@ class InlineElement {
 			$styleAttrValue = '';
 			foreach ($selItems as $p) {
 				if ($config['iconsInOptionTags']) {
-					$styleAttrValue = $this->fObj->optionTagStyle($p[2]);
+					$styleAttrValue = FormEngineUtility::optionTagStyle($p[2]);
 				}
 				if (!in_array($p[1], $uniqueIds)) {
 					$opt[] = '<option value="' . htmlspecialchars($p[1]) . '"' . ' style="' . (in_array($p[1], $uniqueIds) ? '' : '') . ($styleAttrValue ? ' style="' . htmlspecialchars($styleAttrValue) : '') . '">' . htmlspecialchars($p[0]) . '</option>';
 				}
 			}
 			// Put together the selector box:
-			$selector_itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : ' style="' . $this->fObj->defaultMultipleSelectorStyle . '"';
+			$selector_itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : '';
 			$size = (int)$conf['size'];
 			$size = $conf['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $conf['autoSizeMax']) : $size;
 			$onChange = 'return inline.importNewRecord(\'' . $this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '\')';
@@ -985,7 +988,8 @@ class InlineElement {
 				' . $createNewRelationText . '
 			</a>';
 
-		if ($showUpload && $this->fObj->edit_docModuleUpload) {
+		$isDirectFileUploadEnabled = (bool)$this->getBackendUserAuthentication()->uc['edit_docModuleUpload'];
+		if ($showUpload && $isDirectFileUploadEnabled) {
 			$folder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
 			if (
 				$folder instanceof \TYPO3\CMS\Core\Resource\Folder
@@ -1101,7 +1105,7 @@ class InlineElement {
 	 * @return void
 	 */
 	public function addJavaScriptSortable($objectId) {
-		$this->fObj->additionalJS_post[] = '
+		$this->formEngine->additionalJS_post[] = '
 			inline.createDragAndDropSorting("' . $objectId . '");
 		';
 	}
@@ -1194,7 +1198,6 @@ class InlineElement {
 		$GLOBALS['SOBE']->MOD_MENU = array(
 			'showPalettes' => '',
 			'showDescriptions' => '',
-			'disableRTE' => ''
 		);
 		// Setting virtual document name
 		$GLOBALS['SOBE']->MCONF['name'] = 'xMOD_alt_doc.php';
@@ -1209,14 +1212,6 @@ class InlineElement {
 		$GLOBALS['SOBE']->tceforms->RTEcounter = (int)array_shift($ajaxArguments);
 		$GLOBALS['SOBE']->tceforms->initDefaultBEMode();
 		$GLOBALS['SOBE']->tceforms->palettesCollapsed = !$GLOBALS['SOBE']->MOD_SETTINGS['showPalettes'];
-		$GLOBALS['SOBE']->tceforms->disableRTE = $GLOBALS['SOBE']->MOD_SETTINGS['disableRTE'];
-		$GLOBALS['SOBE']->tceforms->enableClickMenu = TRUE;
-		$GLOBALS['SOBE']->tceforms->enableTabMenu = TRUE;
-		// Clipboard is initialized:
-		// Start clipboard
-		$GLOBALS['SOBE']->tceforms->clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
-		// Initialize - reads the clipboard content from the user session
-		$GLOBALS['SOBE']->tceforms->clipObj->initializeClipboard();
 	}
 
 	/**
@@ -1232,14 +1227,14 @@ class InlineElement {
 			$jsonArray['headData'] = $headTags;
 		}
 		// Add the JavaScript data that would have been added at the bottom of a regular FormEngine call:
-		$jsonArray['scriptCall'][] = $this->fObj->JSbottom($this->fObj->formName, TRUE);
+		$jsonArray['scriptCall'][] = $this->formEngine->JSbottom('editform', TRUE);
 		// If script.aculo.us Sortable is used, update the Observer to know the record:
 		if ($config['appearance']['useSortable']) {
 			$jsonArray['scriptCall'][] = 'inline.createDragAndDropSorting(\'' . $this->inlineNames['object'] . '_records\');';
 		}
 		// if FormEngine has some JavaScript code to be executed, just do it
-		if ($this->fObj->extJSCODE) {
-			$jsonArray['scriptCall'][] = $this->fObj->extJSCODE;
+		if ($this->formEngine->extJSCODE) {
+			$jsonArray['scriptCall'][] = $this->formEngine->extJSCODE;
 		}
 		// activate "enable tabs" for textareas
 		$jsonArray['scriptCall'][] = 'changeTextareaElements();';
@@ -1282,7 +1277,7 @@ class InlineElement {
 		$collapseAll = isset($config['appearance']['collapseAll']) && $config['appearance']['collapseAll'];
 		$expandSingle = isset($config['appearance']['expandSingle']) && $config['appearance']['expandSingle'];
 		// Put the current level also to the dynNestedStack of FormEngine:
-		$this->fObj->pushToDynNestedStack('inline', $this->inlineNames['object']);
+		$this->formEngine->pushToDynNestedStack('inline', $this->inlineNames['object']);
 		// Dynamically create a new record using \TYPO3\CMS\Backend\Form\DataPreprocessor
 		if (!$foreignUid || !MathUtility::canBeInterpretedAsInteger($foreignUid) || $config['foreign_selector']) {
 			$record = $this->getNewRecord($this->inlineFirstPid, $current['table']);
@@ -1371,7 +1366,7 @@ class InlineElement {
 		// Fade out and fade in the new record in the browser view to catch the user's eye
 		$jsonArray['scriptCall'][] = 'inline.fadeOutFadeIn(\'' . $objectId . '_div\');';
 		// Remove the current level also from the dynNestedStack of FormEngine:
-		$this->fObj->popFromDynNestedStack();
+		$this->formEngine->popFromDynNestedStack();
 		// Return the JSON array:
 		return $jsonArray;
 	}
@@ -1448,7 +1443,7 @@ class InlineElement {
 		$collapseAll = isset($config['appearance']['collapseAll']) && $config['appearance']['collapseAll'];
 		$expandSingle = isset($config['appearance']['expandSingle']) && $config['appearance']['expandSingle'];
 		// Put the current level also to the dynNestedStack of FormEngine:
-		$this->fObj->pushToDynNestedStack('inline', $this->inlineNames['object']);
+		$this->formEngine->pushToDynNestedStack('inline', $this->inlineNames['object']);
 		$record = $this->getRecord($this->inlineFirstPid, $current['table'], $current['uid']);
 		// The HTML-object-id's prefix of the dynamically created record
 		$objectPrefix = $this->inlineNames['object'] . self::Structure_Separator . $current['table'];
@@ -1472,7 +1467,7 @@ class InlineElement {
 			$jsonArray['scriptCall'][] = 'inline.collapseAllRecords(\'' . $objectId . '\',\'' . $objectPrefix . '\',\'' . $record['uid'] . '\');';
 		}
 		// Remove the current level also from the dynNestedStack of FormEngine:
-		$this->fObj->popFromDynNestedStack();
+		$this->formEngine->popFromDynNestedStack();
 		// Return the JSON array:
 		return $jsonArray;
 	}
@@ -1755,7 +1750,12 @@ class InlineElement {
 		$config = $PA['fieldConf']['config'];
 		if ($foreignConfig['type'] == 'select') {
 			// Getting the selector box items from the system
-			$selItems = $this->fObj->addSelectOptionsToItemArray($this->fObj->initItemArray($PA['fieldConf']), $PA['fieldConf'], $this->fObj->setTSconfig($table, $row), $field);
+			$selItems = FormEngineUtility::addSelectOptionsToItemArray(
+				FormEngineUtility::initItemArray($PA['fieldConf']),
+				$PA['fieldConf'],
+				FormEngineUtility::getTSconfigForTableRow($table, $row),
+				$field
+			);
 
 			// Possibly filter some items:
 			$selItems = ArrayUtility::keepItemsInArray(
@@ -1767,9 +1767,10 @@ class InlineElement {
 			);
 
 			// Possibly add some items:
-			$selItems = $this->fObj->addItems($selItems, $PA['fieldTSConfig']['addItems.']);
+			$selItems = FormEngineUtility::addItems($selItems, $PA['fieldTSConfig']['addItems.']);
 			if (isset($config['itemsProcFunc']) && $config['itemsProcFunc']) {
-				$selItems = $this->fObj->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field);
+				$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+				$selItems = $dataPreprocessor->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field);
 			}
 			// Possibly remove some items:
 			$removeItems = GeneralUtility::trimExplode(',', $PA['fieldTSConfig']['removeItems'], TRUE);
@@ -1877,7 +1878,6 @@ class InlineElement {
 		$trData = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\DataPreprocessor::class);
 		$trData->addRawData = TRUE;
 		$trData->lockRecords = 1;
-		$trData->disableRTE = $GLOBALS['SOBE']->MOD_SETTINGS['disableRTE'];
 		// If a new record should be created
 		$trData->fetchRecord($table, $uid, $cmd === 'new' ? 'new' : '');
 		$rec = reset($trData->regTableItems_data);
@@ -2098,10 +2098,10 @@ class InlineElement {
 					if ($loadConfig) {
 						$unstable['config'] = $GLOBALS['TCA'][$unstable['table']]['columns'][$unstable['field']]['config'];
 						// Fetch TSconfig:
-						$TSconfig = $this->fObj->setTSconfig($unstable['table'], array('uid' => $unstable['uid'], 'pid' => $this->inlineFirstPid), $unstable['field']);
+						$TSconfig = FormEngineUtility::getTSconfigForTableRow($unstable['table'], array('uid' => $unstable['uid'], 'pid' => $this->inlineFirstPid), $unstable['field']);
 						// Override TCA field config by TSconfig:
 						if (!$TSconfig['disabled']) {
-							$unstable['config'] = $this->fObj->overrideFieldConf($unstable['config'], $TSconfig);
+							$unstable['config'] = FormEngineUtility::overrideFieldConf($unstable['config'], $TSconfig);
 						}
 						$unstable['localizationMode'] = BackendUtility::getInlineLocalizationMode($unstable['table'], $unstable['config']);
 					}
@@ -2288,8 +2288,8 @@ class InlineElement {
 		if ($style) {
 			$style = ' style="' . $style . '"';
 		}
-		if (!$tableAttrs['background'] && $this->fObj->borderStyle[2]) {
-			$tableAttrs['background'] = $this->backPath . $this->borderStyle[2];
+		if (!$tableAttrs['background'] && $this->formEngine->borderStyle[2]) {
+			$tableAttrs['background'] = $this->borderStyle[2];
 		}
 		if (!$tableAttrs['class'] && $this->borderStyle[3]) {
 			$tableAttrs['class'] = $this->borderStyle[3];
@@ -2479,7 +2479,7 @@ class InlineElement {
 			}
 			$PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ?: $PA['fieldConf']['config']['type'];
 			// Using "form_type" locally in this script
-			$PA['fieldTSConfig'] = $this->fObj->setTSconfig($foreign_table, array(), $field);
+			$PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($foreign_table, array(), $field);
 			$config = $PA['fieldConf']['config'];
 			// Determine type of Selector:
 			$type = $this->getPossibleRecordsSelectorType($config);
@@ -2639,7 +2639,7 @@ class InlineElement {
 	 */
 	protected function getHeadTags() {
 		$headTags = array();
-		$headDataRaw = $this->fObj->JStop() . $this->getJavaScriptAndStyleSheetsOfPageRenderer();
+		$headDataRaw = $this->formEngine->JStop() . $this->getJavaScriptAndStyleSheetsOfPageRenderer();
 		if ($headDataRaw) {
 			// Create instance of the HTML parser:
 			$parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Html\HtmlParser::class);
@@ -2707,7 +2707,7 @@ class InlineElement {
 		$flexFormParts = NULL;
 
 		$matches = array();
-		$prefix = preg_quote($this->fObj->prependFormFieldNames, '#');
+		$prefix = preg_quote($this->formEngine->prependFormFieldNames, '#');
 
 		if (preg_match('#^' . $prefix . '(?:\[[^]]+\]){3}(\[data\](?:\[[^]]+\]){4,})$#', $formElementName, $matches)) {
 			$flexFormParts = GeneralUtility::trimExplode(
@@ -2733,4 +2733,11 @@ class InlineElement {
 		return $GLOBALS['TYPO3_DB'];
 	}
 
+	/**
+	 * @return BackendUserAuthentication
+	 */
+	protected function getBackendUserAuthentication() {
+		return $GLOBALS['BE_USER'];
+	}
+
 }
diff --git a/typo3/sysext/backend/Classes/Form/Element/InputElement.php b/typo3/sysext/backend/Classes/Form/Element/InputElement.php
index 83528da035dc4728f06359e56252493fe0fb262a..04f2d54507c4e52d6016e9b26c6ca54eb279b710 100644
--- a/typo3/sysext/backend/Classes/Form/Element/InputElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/InputElement.php
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Backend\Form\FormEngine;
 
 /**
  * Generation of TCEform elements of the type "input"
@@ -39,7 +40,7 @@ class InputElement extends AbstractFormElement {
 
 		$config = $additionalInformation['fieldConf']['config'];
 		$specConf = BackendUtility::getSpecConfParts($additionalInformation['extra'], $additionalInformation['fieldConf']['defaultExtras']);
-		$size = MathUtility::forceIntegerInRange($config['size'] ?: $this->formEngine->defaultInputWidth, $this->formEngine->minimumInputWidth, $this->formEngine->maxInputWidth);
+		$size = MathUtility::forceIntegerInRange($config['size'] ?: $this->defaultInputWidth, $this->minimumInputWidth, $this->maxInputWidth);
 		$evalList = GeneralUtility::trimExplode(',', $config['eval'], TRUE);
 		$classes = array();
 		$attributes = array();
@@ -65,7 +66,7 @@ class InputElement extends AbstractFormElement {
 		$dateFormats['datetimesec'] = $dateFormats['timesec'] . ' ' . $dateFormats['date'];
 
 		// readonly
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$itemFormElValue = $additionalInformation['itemFormElValue'];
 			if (in_array('date', $evalList)) {
 				$config['format'] = 'date';
@@ -77,7 +78,15 @@ class InputElement extends AbstractFormElement {
 			if (in_array('password', $evalList)) {
 				$itemFormElValue = $itemFormElValue ? '*********' : '';
 			}
-			return $this->formEngine->getSingleField_typeNone_render($config, $itemFormElValue);
+			$formEngineDummy = new FormEngine;
+			$noneElement = GeneralUtility::makeInstance(NoneElement::class, $formEngineDummy);
+			$elementConfiguration = array(
+				'fieldConf' => array(
+					'config' => $config,
+				),
+				'itemFormElValue' => $itemFormElValue,
+			);
+			return $noneElement->render('', '', '', $elementConfiguration);
 		}
 
 
@@ -210,7 +219,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
 			<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '" value="' . htmlspecialchars($additionalInformation['itemFormElValue']) . '" />';
 
 		// Wrap a wizard around the item?
-		$item = $this->formEngine->renderWizards(
+		$item = $this->renderWizards(
 			array($item, $altItem),
 			$config['wizards'],
 			$table,
@@ -221,7 +230,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
 		);
 
 		// Add a wrapper to remain maximum width
-		$width = (int)$this->formEngine->formMaxWidth($size);
+		$width = (int)$this->formMaxWidth($size);
 		$item = '<div class="form-control-wrap"' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>' . $item . '</div>';
 		return $item;
 	}
diff --git a/typo3/sysext/backend/Classes/Form/Element/NoneElement.php b/typo3/sysext/backend/Classes/Form/Element/NoneElement.php
index 13b83ae50b0ea2e17960845be63858c54455dc35..30869fa4ad5b410e98ce41dfb4c9164f086ea7e0 100644
--- a/typo3/sysext/backend/Classes/Form/Element/NoneElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/NoneElement.php
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+
 /**
  * Generation of TCEform elements where no rendering could be found
  */
@@ -31,7 +35,139 @@ class NoneElement extends AbstractFormElement {
 	public function render($table, $field, $row, &$additionalInformation) {
 		$config = $additionalInformation['fieldConf']['config'];
 		$itemValue = $additionalInformation['itemFormElValue'];
-		return $this->formEngine->getSingleField_typeNone_render($config, $itemValue);
+
+		if ($config['format']) {
+			$itemValue = $this->formatValue($config, $itemValue);
+		}
+		if (!$config['pass_content']) {
+			$itemValue = htmlspecialchars($itemValue);
+		}
+
+		$rows = (int)$config['rows'];
+		// Render as textarea
+		if ($rows > 1 || $config['type'] === 'text') {
+			if (!$config['pass_content']) {
+				$itemValue = nl2br($itemValue);
+			}
+			$cols = MathUtility::forceIntegerInRange($config['cols'] ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
+			$width = $this->formMaxWidth($cols);
+			$item = '
+				<div class="form-control-wrap"' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>
+					<textarea class="form-control" rows="' . $rows . '" disabled>' . $itemValue . '</textarea>
+				</div>';
+		} else {
+			$cols = $config['cols'] ?: ($config['size'] ?: $this->defaultInputWidth);
+			$size = MathUtility::forceIntegerInRange($cols ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
+			$width = $this->formMaxWidth($size);
+			$item = '
+				<div class="form-control-wrap"' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>
+					<input class="form-control" value="'. $itemValue .'" type="text" disabled>
+				</div>
+				' . ((string)$itemValue !== '' ? '<p class="help-block">' . $itemValue . '</p>' : '');
+		}
+		return $item;
+	}
+
+	/**
+	 * Format field content if $config['format'] is set to date, filesize, ..., user
+	 *
+	 * @param array $config Configuration for the display
+	 * @param string $itemValue The value to display
+	 * @return string Formatted field value
+	 */
+	protected function formatValue($config, $itemValue) {
+		$format = trim($config['format']);
+		switch ($format) {
+			case 'date':
+				if ($itemValue) {
+					$option = trim($config['format.']['option']);
+					if ($option) {
+						if ($config['format.']['strftime']) {
+							$value = strftime($option, $itemValue);
+						} else {
+							$value = date($option, $itemValue);
+						}
+					} else {
+						$value = date('d-m-Y', $itemValue);
+					}
+				} else {
+					$value = '';
+				}
+				if ($config['format.']['appendAge']) {
+					$age = BackendUtility::calcAge(
+						$GLOBALS['EXEC_TIME'] - $itemValue,
+						$this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
+					);
+					$value .= ' (' . $age . ')';
+				}
+				$itemValue = $value;
+				break;
+			case 'datetime':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i d-m-Y', (int)$itemValue);
+				}
+				break;
+			case 'time':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i', (int)$itemValue);
+				}
+				break;
+			case 'timesec':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i:s', (int)$itemValue);
+				}
+				break;
+			case 'year':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('Y', (int)$itemValue);
+				}
+				break;
+			case 'int':
+				$baseArr = array('dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b');
+				$base = trim($config['format.']['base']);
+				$format = $baseArr[$base] ?: 'd';
+				$itemValue = sprintf('%' . $format, $itemValue);
+				break;
+			case 'float':
+				$precision = MathUtility::forceIntegerInRange($config['format.']['precision'], 1, 10, 2);
+				$itemValue = sprintf('%.' . $precision . 'f', $itemValue);
+				break;
+			case 'number':
+				$format = trim($config['format.']['option']);
+				$itemValue = sprintf('%' . $format, $itemValue);
+				break;
+			case 'md5':
+				$itemValue = md5($itemValue);
+				break;
+			case 'filesize':
+				// We need to cast to int here, otherwise empty values result in empty output,
+				// but we expect zero.
+				$value = GeneralUtility::formatSize((int)$itemValue);
+				if ($config['format.']['appendByteSize']) {
+					$value .= ' (' . $itemValue . ')';
+				}
+				$itemValue = $value;
+				break;
+			case 'user':
+				$func = trim($config['format.']['userFunc']);
+				if ($func) {
+					$params = array(
+						'value' => $itemValue,
+						'args' => $config['format.']['userFunc'],
+						'config' => $config,
+						'pObj' => &$this
+					);
+					$itemValue = GeneralUtility::callUserFunction($func, $params, $this);
+				}
+				break;
+			default:
+				// Do nothing e.g. when $format === ''
+		}
+		return $itemValue;
 	}
 
 }
diff --git a/typo3/sysext/backend/Classes/Form/Element/RadioElement.php b/typo3/sysext/backend/Classes/Form/Element/RadioElement.php
index f3519736efdc6f5c99d83fb13b50b9c49805aa03..18e25a64a9757691e4ba3bc4f8a14e89d446c46b 100644
--- a/typo3/sysext/backend/Classes/Form/Element/RadioElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/RadioElement.php
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
+
 /**
  * Generation of TCEform elements of the type "radio"
  */
@@ -32,14 +36,15 @@ class RadioElement extends AbstractFormElement {
 		$config = $additionalInformation['fieldConf']['config'];
 		$item = '';
 		$disabled = '';
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = ' disabled';
 		}
 
 		// Get items for the array
-		$selectedItems = $this->formEngine->initItemArray($additionalInformation['fieldConf']);
+		$selectedItems = FormEngineUtility::initItemArray($additionalInformation['fieldConf']);
 		if ($config['itemsProcFunc']) {
-			$selectedItems = $this->formEngine->procItems(
+			$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+			$selectedItems = $dataPreprocessor->procItems(
 				$selectedItems,
 				$additionalInformation['fieldTSConfig']['itemsProcFunc.'],
 				$config,
diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectElement.php
index 6875cb72b2964745dc8cc1b476e85f89c6bd4681..ae1ef9d7114c91d85db5bf1ed68b8d0e9fc92490 100644
--- a/typo3/sysext/backend/Classes/Form/Element/SelectElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/SelectElement.php
@@ -19,6 +19,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 
 /**
  * Generation of TCEform elements of the type "select"
@@ -69,7 +71,7 @@ class SelectElement extends AbstractFormElement {
 		// Field configuration from TCA:
 		$config = $additionalInformation['fieldConf']['config'];
 		$disabled = '';
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = ' disabled="disabled"';
 		}
 		// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist.
@@ -105,7 +107,7 @@ class SelectElement extends AbstractFormElement {
 		// Wizards:
 		if (!$disabled) {
 			$altItem = '<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '" value="' . htmlspecialchars($additionalInformation['itemFormElValue']) . '" />';
-			$item = $this->formEngine->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $additionalInformation, $additionalInformation['itemFormElName'], $specConf);
+			$item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $additionalInformation, $additionalInformation['itemFormElName'], $specConf);
 		}
 		return $item;
 	}
@@ -128,7 +130,7 @@ class SelectElement extends AbstractFormElement {
 		$languageService = $this->getLanguageService();
 		$item = '';
 		$disabled = '';
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = ' disabled="disabled"';
 		}
 		// Setting this hidden field (as a flag that JavaScript can read out)
@@ -196,7 +198,7 @@ class SelectElement extends AbstractFormElement {
 			$styleAttrValue = '';
 			foreach ($selItems as $p) {
 				if ($config['iconsInOptionTags']) {
-					$styleAttrValue = $this->formEngine->optionTagStyle($p[2]);
+					$styleAttrValue = FormEngineUtility::optionTagStyle($p[2]);
 				}
 				$opt[] = '<option value="' . htmlspecialchars($p[1]) . '"'
 					. ($styleAttrValue ? ' style="' . htmlspecialchars($styleAttrValue) . '"' : '')
@@ -205,7 +207,7 @@ class SelectElement extends AbstractFormElement {
 			// Put together the selector box:
 			$selector_itemListStyle = isset($config['itemListStyle'])
 				? ' style="' . htmlspecialchars($config['itemListStyle']) . '"'
-				: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"';
+				: '';
 			$size = (int)$config['size'];
 			$size = $config['autoSizeMax']
 				? MathUtility::forceIntegerInRange(count($itemArray) + 1, MathUtility::forceIntegerInRange($size, 1), $config['autoSizeMax'])
@@ -264,7 +266,7 @@ class SelectElement extends AbstractFormElement {
 			'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
 			'style' => isset($config['selectedListStyle'])
 				? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
-				: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
+				: '',
 			'dontShowMoveIcons' => $maxitems <= 1,
 			'maxitems' => $maxitems,
 			'info' => '',
@@ -277,7 +279,7 @@ class SelectElement extends AbstractFormElement {
 			'rightbox' => $itemsToSelect,
 			'readOnly' => $disabled
 		);
-		$item .= $this->formEngine->dbFileIcons($PA['itemFormElName'], '', '', $itemArray, '', $params, $PA['onFocus']);
+		$item .= $this->dbFileIcons($PA['itemFormElName'], '', '', $itemArray, '', $params, $PA['onFocus']);
 		return $item;
 	}
 
@@ -296,10 +298,10 @@ class SelectElement extends AbstractFormElement {
 		$config = $PA['fieldConf']['config'];
 
 		// Getting the selector box items from the system
-		$selectItems = $this->formEngine->addSelectOptionsToItemArray(
-			$this->formEngine->initItemArray($PA['fieldConf']),
+		$selectItems = FormEngineUtility::addSelectOptionsToItemArray(
+			FormEngineUtility::initItemArray($PA['fieldConf']),
 			$PA['fieldConf'],
-			$this->formEngine->setTSconfig($table, $row),
+			FormEngineUtility::getTSconfigForTableRow($table, $row),
 			$fieldName
 		);
 
@@ -313,11 +315,12 @@ class SelectElement extends AbstractFormElement {
 		);
 
 		// Possibly add some items:
-		$selectItems = $this->formEngine->addItems($selectItems, $PA['fieldTSConfig']['addItems.']);
+		$selectItems = FormEngineUtility::addItems($selectItems, $PA['fieldTSConfig']['addItems.']);
 
 		// Process items by a user function:
 		if (isset($config['itemsProcFunc']) && $config['itemsProcFunc']) {
-			$selectItems = $this->formEngine->procItems($selectItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $fieldName);
+			$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+			$selectItems = $dataPreprocessor->procItems($selectItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $fieldName);
 		}
 
 		// Possibly remove some items:
@@ -409,7 +412,7 @@ class SelectElement extends AbstractFormElement {
 		$out = '';
 		$options = '';
 		$disabled = FALSE;
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = TRUE;
 			$onlySelectedIconShown = 1;
 		}
@@ -444,12 +447,12 @@ class SelectElement extends AbstractFormElement {
 				}
 				$selectItemGroups[$selectItemGroupCount]['header'] = array(
 					'title' => $item[0],
-					'icon' => (!empty($item[2]) ? $this->formEngine->getIconHtml($item[2]) : '')
+					'icon' => (!empty($item[2]) ? FormEngineUtility::getIconHtml($item[2]) : ''),
 				);
 			} else {
 				// IS ITEM
 				$title = htmlspecialchars($item['0'], ENT_COMPAT, 'UTF-8', FALSE);
-				$icon = (!empty($item[2]) ? $this->formEngine->getIconHtml($item[2], $title, $title) : '');
+				$icon = !empty($item[2]) ? FormEngineUtility::getIconHtml($item[2], $title, $title) : '';
 				$selected = ((string)$PA['itemFormElValue'] === (string)$item[1] ? 1 : 0);
 				if ($selected) {
 					$selectedIndex = $selectItemCounter;
@@ -466,10 +469,10 @@ class SelectElement extends AbstractFormElement {
 				);
 				// ICON
 				if ($icon && !$suppressIcons && (!$onlySelectedIconShown || $selected)) {
-					$onClick = $this->formEngine->elName($PA['itemFormElName']) . '.selectedIndex=' . $selectItemCounter . ';';
+					$onClick = 'document.editform[' . GeneralUtility::quoteJSvalue($PA['itemFormElName']) . '].selectedIndex=' . $selectItemCounter . ';';
 					if ($config['iconsInOptionTags']) {
 						$onClick .= 'document.getElementById(\'' . $selectId . '_icon\').innerHTML = '
-							. $this->formEngine->elName($PA['itemFormElName'])
+							. 'document.editform[' . GeneralUtility::quoteJSvalue($PA['itemFormElName']) . ']'
 							. '.options[' . $selectItemCounter . '].getAttribute(\'data-icon\'); ';
 					}
 					$onClick .= implode('', $PA['fieldChangeFunc']);
@@ -588,12 +591,12 @@ class SelectElement extends AbstractFormElement {
 			return '';
 		}
 		// 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']));
+		$itemArray = array_flip(FormEngineUtility::extractValuesOnlyFromValueLabelList($PA['itemFormElValue']));
 		$output = '';
 
 		// Disabled
 		$disabled = 0;
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = 1;
 		}
 		// Traverse the Array of selector box items:
@@ -609,7 +612,7 @@ class SelectElement extends AbstractFormElement {
 				if ($p[1] === '--div--') {
 					$selIcon = '';
 					if (isset($p[2]) && $p[2] != 'empty-emtpy') {
-						$selIcon = $this->formEngine->getIconHtml($p[2]);
+						$selIcon = FormEngineUtility::getIconHtml($p[2]);
 					}
 					$currentGroup++;
 					$groups[$currentGroup]['header'] = array(
@@ -654,7 +657,7 @@ class SelectElement extends AbstractFormElement {
 						'checked' => $checked,
 						'disabled' => $disabled,
 						'class' => '',
-						'icon' => (!empty($p[2]) ? $this->formEngine->getIconHtml($p[2]) : IconUtility::getSpriteIcon('empty-empty')),
+						'icon' => (!empty($p[2]) ? FormEngineUtility::getIconHtml($p[2]) : IconUtility::getSpriteIcon('empty-empty')),
 						'title' => htmlspecialchars($p[0], ENT_COMPAT, 'UTF-8', FALSE),
 						'help' => $help
 					);
@@ -727,9 +730,9 @@ class SelectElement extends AbstractFormElement {
 							<td>' . $item['help'] . '</td>
 						</tr>
 						';
-					$checkGroup[] = $this->formEngine->elName($item['name']) . '.checked=1;';
-					$uncheckGroup[] = $this->formEngine->elName($item['name']) . '.checked=0;';
-					$resetGroup[] = $this->formEngine->elName($item['name']) . '.checked='.$item['checked'] . ';';
+					$checkGroup[] = 'document.editform[' . GeneralUtility::quoteJSvalue($item['name']) . '].checked=1;';
+					$uncheckGroup[] = 'document.editform[' . GeneralUtility::quoteJSvalue($item['name']) . '].checked=0;';
+					$resetGroup[] = 'document.editform[' . GeneralUtility::quoteJSvalue($item['name']) . '].checked='.$item['checked'] . ';';
 				}
 
 				// Build toggle group checkbox
@@ -791,10 +794,10 @@ class SelectElement extends AbstractFormElement {
 	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']));
+		$itemArray = array_flip(FormEngineUtility::extractValuesOnlyFromValueLabelList($PA['itemFormElValue']));
 		$item = '';
 		$disabled = '';
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$disabled = ' disabled="disabled"';
 		}
 		// Traverse the Array of selector box items:
@@ -807,7 +810,7 @@ class SelectElement extends AbstractFormElement {
 			$sM = '';
 			if (isset($itemArray[$p[1]])) {
 				$sM = ' selected="selected"';
-				$restoreCmd[] = $this->formEngine->elName(($PA['itemFormElName'] . '[]')) . '.options[' . $c . '].selected=1;';
+				$restoreCmd[] = 'document.editform[' . GeneralUtility::quoteJSvalue($PA['itemFormElName'] . '[]') . '].options[' . $c . '].selected=1;';
 				unset($itemArray[$p[1]]);
 			}
 			// Non-selectable element:
@@ -818,7 +821,7 @@ class SelectElement extends AbstractFormElement {
 			// Icon style for option tag:
 			$styleAttrValue = '';
 			if ($config['iconsInOptionTags']) {
-				$styleAttrValue = $this->formEngine->optionTagStyle($p[2]);
+				$styleAttrValue = FormEngineUtility::optionTagStyle($p[2]);
 			}
 			// Compile <option> tag:
 			$opt[] = '<option value="' . htmlspecialchars($p[1]) . '"' . $sM . $nonSel
@@ -838,7 +841,7 @@ class SelectElement extends AbstractFormElement {
 		$sOnChange = implode('', $PA['fieldChangeFunc']);
 		$selector_itemListStyle = isset($config['itemListStyle'])
 			? ' style="' . htmlspecialchars($config['itemListStyle']) . '"'
-			: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"';
+			: '';
 		$size = (int)$config['size'];
 		$cssPrefix = $size === 1 ? 'tceforms-select' : 'tceforms-multiselect';
 		$size = $config['autoSizeMax']
@@ -856,8 +859,8 @@ class SelectElement extends AbstractFormElement {
 			$item .= '<input type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" value="" />';
 		}
 		// Put it all into a table:
-		$onClick = htmlspecialchars($this->formEngine->elName(($PA['itemFormElName'] . '[]')) . '.selectedIndex=-1;' . implode('', $restoreCmd) . ' return false;');
-		$width = $this->formEngine->formMaxWidth($this->formEngine->defaultInputWidth);
+		$onClick = htmlspecialchars('document.editform[' . GeneralUtility::quoteJSvalue($PA['itemFormElName'] . '[]') . '].selectedIndex=-1;' . implode('', $restoreCmd) . ' return false;');
+		$width = $this->formMaxWidth($this->defaultInputWidth);
 		$item .= '
 			<div class="form-control-wrap" ' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>
 				<div class="form-wizards-wrap form-wizards-aside">
@@ -902,8 +905,8 @@ class SelectElement extends AbstractFormElement {
 		$PA = array();
 		$PA['fieldConf']['config'] = $fieldConfig;
 		$PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type'];
-		$PA['fieldTSConfig'] = $this->formEngine->setTSconfig($this->currentTable, $this->currentRow, $fieldName);
-		$PA['fieldConf']['config'] = $this->formEngine->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
+		$PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($this->currentTable, $this->currentRow, $fieldName);
+		$PA['fieldConf']['config'] = FormEngineUtility::overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
 		$selectItemArray = $this->getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA);
 
 		if ($isTraversable && count($selectItemArray)) {
diff --git a/typo3/sysext/backend/Classes/Form/Element/TextElement.php b/typo3/sysext/backend/Classes/Form/Element/TextElement.php
index 778761c53b9cfdc61f567670b2bca7cd19c458e9..12b1d4c1afcda5d6e7c4fab9302ee0c3b0b65a35 100644
--- a/typo3/sysext/backend/Classes/Form/Element/TextElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/TextElement.php
@@ -23,6 +23,14 @@ use TYPO3\CMS\Core\Utility\MathUtility;
  */
 class TextElement extends AbstractFormElement {
 
+	/**
+	 * The number of chars expected per row when the height of a text area field is
+	 * automatically calculated based on the number of characters found in the field content.
+	 *
+	 * @var int
+	 */
+	protected $charactersPerRow = 40;
+
 	/**
 	 * This will render a <textarea> OR RTE area form field,
 	 * possibly with various control/validation features
@@ -34,20 +42,22 @@ class TextElement extends AbstractFormElement {
 	 * @return string The HTML code for the TCEform field
 	 */
 	public function render($table, $field, $row, &$additionalInformation) {
+		$backendUser = $this->getBackendUserAuthentication();
+
 		$config = $additionalInformation['fieldConf']['config'];
 
 		// Setting columns number
-		$cols = MathUtility::forceIntegerInRange($config['cols'] ?: $this->formEngine->defaultInputWidth, $this->formEngine->minimumInputWidth, $this->formEngine->maxInputWidth);
+		$cols = MathUtility::forceIntegerInRange($config['cols'] ?: $this->defaultInputWidth, $this->minimumInputWidth, $this->maxInputWidth);
 
 		// Setting number of rows
 		$rows = MathUtility::forceIntegerInRange($config['rows'] ?: 5, 1, 20);
 		$originalRows = $rows;
 
 		$itemFormElementValueLength = strlen($additionalInformation['itemFormElValue']);
-		if ($itemFormElementValueLength > $this->formEngine->charsPerRow * 2) {
-			$cols = $this->formEngine->maxInputWidth;
+		if ($itemFormElementValueLength > $this->charactersPerRow * 2) {
+			$cols = $this->maxInputWidth;
 			$rows = MathUtility::forceIntegerInRange(
-				round($itemFormElementValueLength / $this->formEngine->charsPerRow),
+				round($itemFormElementValueLength / $this->charactersPerRow),
 				count(explode(LF, $additionalInformation['itemFormElValue'])),
 				20
 			);
@@ -58,10 +68,17 @@ class TextElement extends AbstractFormElement {
 
 		// must be called after the cols and rows calculation, so the parameters are applied
 		// to read-only fields as well.
-		if ($this->isRenderReadonly() || $config['readOnly']) {
+		if ($this->isGlobalReadonly() || $config['readOnly']) {
 			$config['cols'] = $cols;
 			$config['rows'] = $rows;
-			return $this->formEngine->getSingleField_typeNone_render($config, $additionalInformation['itemFormElValue']);
+			$noneElement = GeneralUtility::makeInstance(NoneElement::class, $this->formEngine);
+			$elementConfiguration = array(
+				'fieldConf' => array(
+					'config' => $config,
+				),
+				'itemFormElValue' => $additionalInformation['itemFormElValue'],
+			);
+			return $noneElement->render('', '', '', $elementConfiguration);
 		}
 
 		$evalList = GeneralUtility::trimExplode(',', $config['eval'], TRUE);
@@ -79,7 +96,7 @@ class TextElement extends AbstractFormElement {
 		$altItem = '<input type="hidden" name="' . htmlspecialchars($additionalInformation['itemFormElName']) . '" value="' . htmlspecialchars($additionalInformation['itemFormElValue']) . '" />';
 		$item = '';
 		// If RTE is generally enabled (TYPO3_CONF_VARS and user settings)
-		if ($this->formEngine->RTEenabled) {
+		if ($backendUser->isRTE()) {
 			$parameters = BackendUtility::getSpecConfParametersFromArray($specialConfiguration['rte_transform']['parameters']);
 			// If the field is configured for RTE and if any flag-field is not set to disable it.
 			if (isset($specialConfiguration['richtext']) && (!$parameters['flag'] || !$row[$parameters['flag']])) {
@@ -87,56 +104,40 @@ class TextElement extends AbstractFormElement {
 				list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
 				// If the pid-value is not negative (that is, a pid could NOT be fetched)
 				if ($tsConfigPid >= 0) {
-					$rteSetup = $this->getBackendUserAuthentication()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
+					$rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
 					$rteTcaTypeValue = BackendUtility::getTCAtypeValue($table, $row);
 					$rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $field, $rteTcaTypeValue);
 					if (!$rteSetupConfiguration['disabled']) {
-						if (!$this->formEngine->disableRTE) {
-							$this->formEngine->RTEcounter++;
-							// Get RTE object, draw form and set flag:
-							$rteObject = BackendUtility::RTEgetObj();
-							$item = $rteObject->drawRTE(
-								$this->formEngine,
-								$table,
-								$field,
-								$row,
-								$additionalInformation,
-								$specialConfiguration,
-								$rteSetupConfiguration,
-								$rteTcaTypeValue,
-								'',
-								$tsConfigPid
-							);
-
-							// Wizard
-							$item = $this->formEngine->renderWizards(
-								array($item, $altItem),
-								$config['wizards'],
-								$table,
-								$row,
-								$field,
-								$additionalInformation,
-								$additionalInformation['itemFormElName'],
-								$specialConfiguration,
-								TRUE
-							);
-							$rteWasLoaded = TRUE;
-						} else {
-							$rteWouldHaveBeenLoaded = TRUE;
-							$this->formEngine->commentMessages[] = $additionalInformation['itemFormElName'] . ': RTE is disabled by the on-page RTE-flag (probably you can enable it by the check-box in the bottom of this page!)';
-						}
-					} else {
-						$this->formEngine->commentMessages[] = $additionalInformation['itemFormElName'] . ': RTE is disabled by the Page TSconfig, "RTE"-key (eg. by RTE.default.disabled=0 or such)';
+						$this->formEngine->RTEcounter++;
+						// Get RTE object, draw form and set flag:
+						$rteObject = BackendUtility::RTEgetObj();
+						$item = $rteObject->drawRTE(
+							$this->formEngine,
+							$table,
+							$field,
+							$row,
+							$additionalInformation,
+							$specialConfiguration,
+							$rteSetupConfiguration,
+							$rteTcaTypeValue,
+							'',
+							$tsConfigPid
+						);
+
+						// Wizard
+						$item = $this->renderWizards(
+							array($item, $altItem),
+							$config['wizards'],
+							$table,
+							$row,
+							$field,
+							$additionalInformation,
+							$additionalInformation['itemFormElName'],
+							$specialConfiguration,
+							TRUE
+						);
+						$rteWasLoaded = TRUE;
 					}
-				} else {
-					$this->formEngine->commentMessages[] = $additionalInformation['itemFormElName'] . ': PID value could NOT be fetched. Rare error, normally with new records.';
-				}
-			} else {
-				if (!isset($specialConfiguration['richtext'])) {
-					$this->formEngine->commentMessages[] = $additionalInformation['itemFormElName'] . ': RTE was not configured for this field in TCA-types';
-				}
-				if (!(!$parameters['flag'] || !$row[$parameters['flag']])) {
-					$this->formEngine->commentMessages[] = $additionalInformation['itemFormElName'] . ': Field-flag (' . $additionalInformation['flag'] . ') has been set to disable RTE!';
 				}
 			}
 		}
@@ -178,7 +179,7 @@ class TextElement extends AbstractFormElement {
 				// calculate inline styles
 				$styles = array();
 				// add the max-height from the users' preference to it
-				$maximumHeight = (int)$this->getBackendUserAuthentication()->uc['resizeTextareas_MaxHeight'];
+				$maximumHeight = (int)$backendUser->uc['resizeTextareas_MaxHeight'];
 				if ($maximumHeight > 0) {
 					$styles[] = 'max-height: ' . $maximumHeight . 'px';
 				}
@@ -212,7 +213,7 @@ class TextElement extends AbstractFormElement {
 							. '>' . GeneralUtility::formatForTextarea($additionalInformation['itemFormElValue']) . '</textarea>';
 
 				// Wrap a wizard around the item?
-				$item = $this->formEngine->renderWizards(
+				$item = $this->renderWizards(
 					array($item, $altItem),
 					$config['wizards'],
 					$table,
@@ -224,7 +225,7 @@ class TextElement extends AbstractFormElement {
 					$rteWouldHaveBeenLoaded
 				);
 
-				$maximumWidth = (int)$this->formEngine->formMaxWidth($cols);
+				$maximumWidth = (int)$this->formMaxWidth($cols);
 				$item = '<div class="form-control-wrap"' . ($maximumWidth ? ' style="max-width: ' . $maximumWidth . 'px"' : '') . '>' . $item . '</div>';
 			}
 		}
diff --git a/typo3/sysext/backend/Classes/Form/Element/TreeElement.php b/typo3/sysext/backend/Classes/Form/Element/TreeElement.php
index e18613355ac586e060505eaf8f16b46787042fdf..d6f662f70253464ad5fbd88c679b049c5926d80a 100644
--- a/typo3/sysext/backend/Classes/Form/Element/TreeElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/TreeElement.php
@@ -175,7 +175,7 @@ class TreeElement extends AbstractFormElement {
 				tcaExclusiveKeys: "' . ($PA['fieldConf']['config']['exclusiveKeys'] ? $PA['fieldConf']['config']['exclusiveKeys'] : '') . '",
 				ucId: "' . md5(($table . '|' . $field)) . '",
 				selModel: TYPO3.Components.Tree.EmptySelectionModel,
-				disabled: ' . ($PA['fieldConf']['config']['readOnly'] || $this->isRenderReadonly() ? 'true' : 'false') . '
+				disabled: ' . ($PA['fieldConf']['config']['readOnly'] || $this->isGlobalReadonly() ? 'true' : 'false') . '
 			});' . LF .
 				($autoSizeMax
 					? 'tree' . $id . '.bodyStyle = "max-height: ' . $autoSizeMax . 'px;min-height: ' . $height . 'px;";'
diff --git a/typo3/sysext/backend/Classes/Form/Element/UnknownElement.php b/typo3/sysext/backend/Classes/Form/Element/UnknownElement.php
index c0e03605f84f63276ec39da01b71e769e34bacad..536ab805c20040cb407c5e9b348479adb2538253 100644
--- a/typo3/sysext/backend/Classes/Form/Element/UnknownElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/UnknownElement.php
@@ -30,7 +30,6 @@ class UnknownElement extends AbstractFormElement {
 	 */
 	public function render($table, $field, $row, &$additionalInformation) {
 		return 'Unknown type: ' . $additionalInformation['fieldConf']['config']['form_type'] . '<br />';
-
 	}
 
 }
diff --git a/typo3/sysext/backend/Classes/Form/FlexFormsHelper.php b/typo3/sysext/backend/Classes/Form/FlexFormsHelper.php
index 6dc240a7602122350f8016ee208443fbf4b2339d..756639611dbe184c7fb0cee02c3a0a774fbb27c0 100644
--- a/typo3/sysext/backend/Classes/Form/FlexFormsHelper.php
+++ b/typo3/sysext/backend/Classes/Form/FlexFormsHelper.php
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form;
 
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 
 /**
  * Contains FlexForm manipulation methods as part of the TCEforms
@@ -79,7 +80,7 @@ class FlexFormsHelper extends \TYPO3\CMS\Backend\Form\FormEngine {
 			return $dataStructure;
 		}
 		// Get field configuration from page TSConfig
-		$TSconfig = $this->setTSconfig($table, $tableRow);
+		$TSconfig = FormEngineUtility::getTSconfigForTableRow($table, $tableRow);
 		if (!empty($TSconfig[$tableField][($flexformIdentifier . '.')])) {
 			$sheetConf = GeneralUtility::removeDotsFromTS($TSconfig[$tableField][$flexformIdentifier . '.']);
 		}
@@ -187,7 +188,7 @@ class FlexFormsHelper extends \TYPO3\CMS\Backend\Form\FormEngine {
 				continue;
 			}
 			// Getting the selector box items from system
-			$selItems = $this->addSelectOptionsToItemArray($this->initItemArray($field['TCEforms']), $field['TCEforms'], $this->setTSconfig($table, $tableRow), $tableField);
+			$selItems = FormEngineUtility::addSelectOptionsToItemArray(FormEngineUtility::initItemArray($field['TCEforms']), $field['TCEforms'], FormEngineUtility::getTSconfigForTableRow($table, $tableRow), $tableField);
 
 			// Possibly filter some items
 			$selItems = ArrayUtility::keepItemsInArray(
@@ -199,10 +200,11 @@ class FlexFormsHelper extends \TYPO3\CMS\Backend\Form\FormEngine {
 			);
 
 			// Possibly add some items
-			$selItems = $this->addItems($selItems, $addItems);
+			$selItems = FormEngineUtility::addItems($selItems, $addItems);
 			// Process items by a user function
 			if (!empty($field['TCEforms']['config']['itemsProcFunc'])) {
-				$selItems = $this->procItems($selItems, $fieldConf['config'], $field['TCEforms']['config'], $table, $tableRow, $tableField);
+				$dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
+				$selItems = $dataPreprocessor->procItems($selItems, $fieldConf['config'], $field['TCEforms']['config'], $table, $tableRow, $tableField);
 			}
 			// Remove special configuration options after creating items to prevent double parsing
 			foreach ($this->removeSelectConfig as $option) {
diff --git a/typo3/sysext/backend/Classes/Form/FormEngine.php b/typo3/sysext/backend/Classes/Form/FormEngine.php
index 7250506949c9433b880a4cdf26503725eeecf396..a1655500cdddcdf788a7c48b5d5d5db88be1acaf 100644
--- a/typo3/sysext/backend/Classes/Form/FormEngine.php
+++ b/typo3/sysext/backend/Classes/Form/FormEngine.php
@@ -14,24 +14,28 @@ namespace TYPO3\CMS\Backend\Form;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
 use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
 use TYPO3\CMS\Backend\Form\Element\InlineElement;
+use TYPO3\CMS\Backend\Form\Element\NoneElement;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Html\HtmlParser;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
-use TYPO3\CMS\Core\Utility\ArrayUtility;
+use TYPO3\CMS\Core\Utility\DiffUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Lang\LanguageService;
 
+
 /**
  * 'TCEforms' - Class for creating the backend editing forms.
  *
@@ -40,67 +44,21 @@ use TYPO3\CMS\Lang\LanguageService;
  */
 class FormEngine {
 
-	/**
-	 * @var array
-	 */
-	public $palFieldArr = array();
-
 	/**
 	 * @var bool
 	 */
 	public $disableWizards = FALSE;
 
-	/**
-	 * @var bool
-	 */
-	public $isPalettedoc = FALSE;
-
-	/**
-	 * @var int
-	 */
-	public $paletteMargin = 1;
-
-	/**
-	 * @var string
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
-	 */
-	public $defStyle = '';
-
-	/**
-	 * @var array
-	 */
-	public $cachedTSconfig = array();
-
-	/**
-	 * @var array
-	 */
-	public $cachedTSconfig_fieldLevel = array();
-
-	/**
-	 * @var array
-	 */
-	public $cachedLanguageFlag = array();
-
 	/**
 	 * @var array|NULL
 	 */
 	public $cachedAdditionalPreviewLanguages = NULL;
 
-	/**
-	 * @var array
-	 */
-	public $transformedRow = array();
-
 	/**
 	 * @var string
 	 */
 	public $extJSCODE = '';
 
-	/**
-	 * @var array
-	 */
-	public $printNeededJS = array();
-
 	/**
 	 * @var array
 	 */
@@ -135,14 +93,6 @@ class FormEngine {
 	 */
 	public $additionalPreviewLanguageData = array();
 
-	/**
-	 * Set this to the 'backPath' pointing back to the typo3 admin directory
-	 * from the script where this form is displayed.
-	 *
-	 * @var string
-	 */
-	public $backPath = '';
-
 	/**
 	 * Alternative return URL path (default is \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript())
 	 *
@@ -167,20 +117,6 @@ class FormEngine {
 	 */
 	public $palettesCollapsed = FALSE;
 
-	/**
-	 * If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!)
-	 *
-	 * @var bool
-	 */
-	public $disableRTE = FALSE;
-
-	/**
-	 * If FALSE, then all CSH will be disabled, regardless of settings in $this->edit_showFieldHelp
-	 *
-	 * @var bool
-	 */
-	public $globalShowHelp = TRUE;
-
 	/**
 	 * If this evaluates to TRUE, the forms are rendering only localization relevant fields of the records.
 	 *
@@ -198,429 +134,230 @@ class FormEngine {
 	public $fieldOrder = '';
 
 	/**
-	 * If set to FALSE, palettes will NEVER be rendered.
+	 * When enabled all elements are rendered non-editable
 	 *
 	 * @var bool
 	 */
-	public $doPrintPalette = TRUE;
+	protected $renderReadonly = FALSE;
 
+	// INTERNAL, static
 	/**
-	 * Set to initialized clipboard object;
-	 * Then the element browser will offer a link to paste in records from clipboard.
+	 * The string to prepend formfield names with.
 	 *
-	 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard|NULL
+	 * @var string
 	 */
-	public $clipObj = NULL;
+	public $prependFormFieldNames = 'data';
 
 	/**
-	 * Enable click menu on reference icons.
+	 * The string to prepend commands for tcemain::process_cmdmap with
 	 *
-	 * @var bool
-	 */
-	public $enableClickMenu = FALSE;
-
-	/**
-	 * @var bool
+	 * @var string
 	 */
-	public $enableTabMenu = FALSE;
+	public $prependCmdFieldNames = 'cmd';
 
 	/**
-	 * When enabled all fields are rendered non-editable
+	 * The string to prepend FILE form field names with
 	 *
-	 * @var bool
+	 * @var string
 	 */
-	protected $renderReadonly = FALSE;
+	public $prependFormFieldNames_file = 'data_files';
 
 	/**
-	 * Form field width compensation: Factor of "size=12" to "style="width: 12*12px"
-	 * for form field widths of style-aware browsers
+	 * The string to prepend form field names that are active (not NULL)
 	 *
-	 * @var float
+	 * @var string
 	 */
-	public $form_rowsToStylewidth = 12;
+	protected $prependFormFieldNamesActive = 'control[active]';
 
 	/**
-	 * Value that gets added for style="width: ...px" for textareas compared to input fields.
+	 * Set by readPerms()  (caching)
 	 *
-	 * @var int
+	 * @var string
 	 */
-	protected $form_additionalTextareaStyleWidth = 23;
+	public $perms_clause = '';
 
 	/**
-	 * Form field width compensation: Compensation for large documents, doc-tab (editing)
+	 * Set by readPerms()  (caching-flag)
 	 *
-	 * @var float
+	 * @var bool
 	 */
-	public $form_largeComp = 1.33;
+	public $perms_clause_set = FALSE;
 
 	/**
-	 * The number of chars expected per row when the height of a text area field is
-	 * automatically calculated based on the number of characters found in the field content.
+	 * Counter that is incremented before an RTE is created. Can be used for unique ids etc.
 	 *
 	 * @var int
 	 */
-	public $charsPerRow = 40;
+	public $RTEcounter = 0;
 
 	/**
-	 * The maximum abstract value for textareas
+	 * Total wrapping for the table rows
 	 *
-	 * @var int
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @var string
 	 */
-	public $maxTextareaWidth = 48;
+	public $totalWrap = '<hr />|<hr />';
 
 	/**
-	 * The default abstract value for input and textarea elements
+	 * Field template
 	 *
-	 * @var int
-	 * @internal
+	 * @var string
 	 */
-	public $defaultInputWidth = 30;
+	public $fieldTemplate = '<strong>###FIELD_NAME###</strong><br />###FIELD_ITEM###<hr />';
 
 	/**
-	 * The minimum abstract value for input and textarea elements
+	 * Template subpart for palette fields
 	 *
-	 * @var int
-	 * @internal
+	 * @var string
 	 */
-	public $minimumInputWidth = 10;
+	protected $paletteFieldTemplate = '';
 
 	/**
-	 * The maximum abstract value for input and textarea elements
+	 * Wrapping template code for a section
 	 *
-	 * @var int
-	 * @internal
+	 * @var string
+	 * @deprecatd since TYPO3 CMS 7, will be removed in CMS 8
 	 */
-	public $maxInputWidth = 50;
+	public $sectionWrap = '';
 
 	/**
-	 * Default style for the selector boxes used for multiple items in "select" and "group" types.
+	 * Template for palette headers
 	 *
 	 * @var string
 	 */
-	public $defaultMultipleSelectorStyle = '';
+	public $palFieldTemplateHeader = '';
 
-	// INTERNAL, static
 	/**
-	 * The string to prepend formfield names with.
+	 * Template for palettes
 	 *
 	 * @var string
 	 */
-	public $prependFormFieldNames = 'data';
+	public $palFieldTemplate = '';
 
 	/**
-	 * The string to prepend commands for tcemain::process_cmdmap with
+	 * Set to the fields NOT to display, if any
 	 *
-	 * @var string
+	 * @var array|NULL
 	 */
-	public $prependCmdFieldNames = 'cmd';
+	public $excludeElements = NULL;
 
 	/**
-	 * The string to prepend FILE form field names with
+	 * During rendering of forms this will keep track of which palettes
+	 * has already been rendered (so they are not rendered twice by mistake)
 	 *
-	 * @var string
+	 * @var array
 	 */
-	public $prependFormFieldNames_file = 'data_files';
+	public $palettesRendered = array();
 
 	/**
-	 * The string to prepend form field names that are active (not NULL)
+	 * This array of fields will be set as hidden-fields instead of rendered normally!
+	 * For instance palette fields edited in the top frame are set as hidden fields
+	 * since the main form has to submit the values.
+	 * The top frame actually just sets the value in the main form!
 	 *
-	 * @var string
+	 * @var array
 	 */
-	protected $prependFormFieldNamesActive = 'control[active]';
+	public $hiddenFieldListArr = array();
 
 	/**
-	 * The name attribute of the form
+	 * Used to register input-field names, which are required. (Done during rendering of the fields).
+	 * This information is then used later when the JavaScript is made.
 	 *
-	 * @var string
+	 * @var array
 	 */
-	public $formName = 'editform';
+	public $requiredFields = array();
 
 	/**
-	 * Whitelist that allows TCA field configuration to be overridden by TSconfig
+	 * Used to register input-field names, which are required an have additional requirements.
+	 * (e.g. like a date/time must be positive integer)
+	 * The information of this array is merged with $this->requiredFields later.
 	 *
-	 * @see overrideFieldConf()
 	 * @var array
 	 */
-	public $allowOverrideMatrix = array();
+	public $requiredAdditional = array();
 
 	/**
-	 * Set by readPerms()  (caching)
+	 * Used to register the min and max number of elements
+	 * for selector boxes where that apply (in the "group" type for instance)
 	 *
-	 * @var string
+	 * @var array
 	 */
-	public $perms_clause = '';
+	public $requiredElements = array();
 
 	/**
-	 * Set by readPerms()  (caching-flag)
+	 * Used to determine where $requiredFields or $requiredElements are nested (in Tabs or IRRE)
 	 *
-	 * @var bool
+	 * @var array
 	 */
-	public $perms_clause_set = FALSE;
+	public $requiredNested = array();
 
 	/**
-	 * Used to indicate the mode of CSH (Context Sensitive Help),
-	 * whether it should be icons-only ('icon') or not at all (blank).
+	 * Keeps track of the rendering depth of nested records
 	 *
-	 * @var bool
+	 * @var int
 	 */
-	public $edit_showFieldHelp = FALSE;
+	public $renderDepth = 0;
 
 	/**
-	 * @var bool
+	 * Color scheme buffer
+	 *
+	 * @var array
+	 * @deprecatd since TYPO3 CMS 7, will be removed in CMS 8
 	 */
-	public $edit_docModuleUpload = FALSE;
+	public $savedSchemes = array();
 
 	/**
-	 * Loaded with info about the browser when class is instantiated
+	 * holds the path an element is nested in (e.g. required for RTEhtmlarea)
 	 *
 	 * @var array
 	 */
-	public $clientInfo = array();
+	public $dynNestedStack = array();
 
+	// Internal, registers for user defined functions etc.
 	/**
-	 * TRUE, if RTE is possible for the current user (based on result from BE_USER->isRTE())
+	 * Additional HTML code, printed before the form
 	 *
-	 * @var bool
+	 * @var array
 	 */
-	public $RTEenabled = FALSE;
+	public $additionalCode_pre = array();
 
 	/**
-	 * If $this->RTEenabled was FALSE, you can find the reasons listed in this array
-	 * which is filled with reasons why the RTE could not be loaded)
+	 * Additional JavaScript, printed before the form
 	 *
-	 * @var string
+	 * @var array
+	 * @deprecatd since TYPO3 CMS 7, will be removed in CMS 8
 	 */
-	public $RTEenabled_notReasons = '';
+	public $additionalJS_pre = array();
 
 	/**
-	 * Counter that is incremented before an RTE is created. Can be used for unique ids etc.
+	 * Additional JavaScript printed after the form
 	 *
-	 * @var int
+	 * @var array
 	 */
-	public $RTEcounter = 0;
+	public $additionalJS_post = array();
 
 	/**
-	 * Contains current color scheme
+	 * Additional JavaScript executed on submit; If you set "OK" variable it will raise an error
+	 * about RTEs not being loaded and offer to block further submission.
 	 *
 	 * @var array
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public $colorScheme = array();
+	public $additionalJS_submit = array();
 
 	/**
-	 * Contains current class scheme
+	 * Additional JavaScript executed when section element is deleted.
+	 * This is necessary, for example, to correctly clean up HTMLArea RTE (bug #8232)
 	 *
 	 * @var array
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public $classScheme = array();
+	public $additionalJS_delete = array();
 
 	/**
-	 * Contains the default color scheme
-	 *
-	 * @var array
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @var \TYPO3\CMS\Backend\Form\Element\InlineElement
 	 */
-	public $defColorScheme = array();
+	public $inline;
 
 	/**
-	 * Contains the default class scheme
-	 *
-	 * @var array
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
-	 */
-	public $defClassScheme = array();
-
-	/**
-	 * Contains field style values
-	 *
-	 * @var array|NULL
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
-	 */
-	public $fieldStyle = NULL;
-
-	/**
-	 * Contains border style values
-	 *
-	 * @var array|NULL
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
-	 */
-	public $borderStyle = NULL;
-
-	/**
-	 * An accumulation of messages from the class
-	 *
-	 * @var array
-	 */
-	public $commentMessages = array();
-
-	/**
-	 * Total wrapping for the table rows
-	 *
-	 * @var string
-	 */
-	public $totalWrap = '<hr />|<hr />';
-
-	/**
-	 * Field template
-	 *
-	 * @var string
-	 */
-	public $fieldTemplate = '<strong>###FIELD_NAME###</strong><br />###FIELD_ITEM###<hr />';
-
-	/**
-	 * Template subpart for palette fields
-	 *
-	 * @var string
-	 */
-	protected $paletteFieldTemplate = '';
-
-	/**
-	 * Wrapping template code for a section
-	 *
-	 * @var string
-	 * @deprecatd since TYPO3 CMS 7, will be removed in CMS 8
-	 */
-	public $sectionWrap = '';
-
-	/**
-	 * Template for palette headers
-	 *
-	 * @var string
-	 */
-	public $palFieldTemplateHeader = '';
-
-	/**
-	 * Template for palettes
-	 *
-	 * @var string
-	 */
-	public $palFieldTemplate = '';
-
-	/**
-	 * Set to the fields NOT to display, if any
-	 *
-	 * @var array|NULL
-	 */
-	public $excludeElements = NULL;
-
-	/**
-	 * During rendering of forms this will keep track of which palettes
-	 * has already been rendered (so they are not rendered twice by mistake)
-	 *
-	 * @var array
-	 */
-	public $palettesRendered = array();
-
-	/**
-	 * This array of fields will be set as hidden-fields instead of rendered normally!
-	 * For instance palette fields edited in the top frame are set as hidden fields
-	 * since the main form has to submit the values.
-	 * The top frame actually just sets the value in the main form!
-	 *
-	 * @var array
-	 */
-	public $hiddenFieldListArr = array();
-
-	/**
-	 * Used to register input-field names, which are required. (Done during rendering of the fields).
-	 * This information is then used later when the JavaScript is made.
-	 *
-	 * @var array
-	 */
-	public $requiredFields = array();
-
-	/**
-	 * Used to register input-field names, which are required an have additional requirements.
-	 * (e.g. like a date/time must be positive integer)
-	 * The information of this array is merged with $this->requiredFields later.
-	 *
-	 * @var array
-	 */
-	public $requiredAdditional = array();
-
-	/**
-	 * Used to register the min and max number of elements
-	 * for selector boxes where that apply (in the "group" type for instance)
-	 *
-	 * @var array
-	 */
-	public $requiredElements = array();
-
-	/**
-	 * Used to determine where $requiredFields or $requiredElements are nested (in Tabs or IRRE)
-	 *
-	 * @var array
-	 */
-	public $requiredNested = array();
-
-	/**
-	 * Keeps track of the rendering depth of nested records
-	 *
-	 * @var int
-	 */
-	public $renderDepth = 0;
-
-	/**
-	 * Color scheme buffer
-	 *
-	 * @var array
-	 */
-	public $savedSchemes = array();
-
-	/**
-	 * holds the path an element is nested in (e.g. required for RTEhtmlarea)
-	 *
-	 * @var array
-	 */
-	public $dynNestedStack = array();
-
-	// Internal, registers for user defined functions etc.
-	/**
-	 * Additional HTML code, printed before the form
-	 *
-	 * @var array
-	 */
-	public $additionalCode_pre = array();
-
-	/**
-	 * Additional JavaScript, printed before the form
-	 *
-	 * @var array
-	 */
-	public $additionalJS_pre = array();
-
-	/**
-	 * Additional JavaScript printed after the form
-	 *
-	 * @var array
-	 */
-	public $additionalJS_post = array();
-
-	/**
-	 * Additional JavaScript executed on submit; If you set "OK" variable it will raise an error
-	 * about RTEs not being loaded and offer to block further submission.
-	 *
-	 * @var array
-	 */
-	public $additionalJS_submit = array();
-
-	/**
-	 * Additional JavaScript executed when section element is deleted.
-	 * This is necessary, for example, to correctly clean up HTMLArea RTE (bug #8232)
-	 *
-	 * @var array
-	 */
-	public $additionalJS_delete = array();
-
-	/**
-	 * @var \TYPO3\CMS\Backend\Form\Element\InlineElement
-	 */
-	public $inline;
-
-	/**
-	 * Array containing hook class instances called once for a form
+	 * Array containing hook class instances called once for a form
 	 *
 	 * @var array
 	 */
@@ -647,11 +384,6 @@ class FormEngine {
 	 */
 	public $templateFile = '';
 
-	/**
-	 * @var \TYPO3\CMS\Backend\Form\Element\SuggestElement
-	 */
-	protected $suggest;
-
 	/**
 	 * protected properties which were public
 	 * use old property name as key and new property name as value
@@ -670,28 +402,9 @@ class FormEngine {
 	 *
 	 */
 	public function __construct() {
-		$this->clientInfo = GeneralUtility::clientInfo();
-		$this->RTEenabled = $this->getBackendUserAuthentication()->isRTE();
-		if (!$this->RTEenabled) {
-			$this->RTEenabled_notReasons = implode(LF, $this->getBackendUserAuthentication()->RTE_errors);
-			$this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:' . LF . $this->RTEenabled_notReasons;
-		}
-		// Define whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf():
-		$this->allowOverrideMatrix = array(
-			'input' => array('size', 'max', 'readOnly'),
-			'text' => array('cols', 'rows', 'wrap', 'readOnly'),
-			'check' => array('cols', 'showIfRTE', 'readOnly'),
-			'select' => array('size', 'autoSizeMax', 'maxitems', 'minitems', 'readOnly', 'treeConfig'),
-			'group' => array('size', 'autoSizeMax', 'max_size', 'show_thumbs', 'maxitems', 'minitems', 'disable_controls', 'readOnly'),
-			'inline' => array('appearance', 'behaviour', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label', 'readOnly')
-		);
 		// Create instance of InlineElement only if this a non-IRRE-AJAX call:
-		if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], \TYPO3\CMS\Backend\Form\Element\InlineElement::class . '::') !== 0) {
-			$this->inline = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\InlineElement::class);
-		}
-		// Create instance of \TYPO3\CMS\Backend\Form\Element\SuggestElement only if this a non-Suggest-AJAX call:
-		if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], \TYPO3\CMS\Backend\Form\Element\SuggestElement::class . '::') !== 0) {
-			$this->suggest = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\SuggestElement::class);
+		if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], InlineElement::class . '::') !== 0) {
+			$this->inline = GeneralUtility::makeInstance(InlineElement::class);
 		}
 		// Prepare user defined objects (if any) for hooks which extend this function:
 		$this->hookObjectsMainFields = array();
@@ -769,12 +482,8 @@ class FormEngine {
 	 */
 	public function initDefaultBEmode() {
 		$this->prependFormFieldNames = 'data';
-		$this->formName = 'editform';
 		$this->setNewBEDesign();
-		$this->edit_showFieldHelp = (bool)$this->getBackendUserAuthentication()->uc['edit_showFieldHelp'];
-		$this->edit_docModuleUpload = (bool)$this->getBackendUserAuthentication()->uc['edit_docModuleUpload'];
 		$this->inline->init($this);
-		$this->suggest->init($this);
 	}
 
 	/*******************************************************
@@ -855,7 +564,7 @@ class FormEngine {
 		$tabIdentStringMD5 = '';
 		if ($GLOBALS['TCA'][$table]) {
 			// Load the description content for the table.
-			if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) {
+			if ($this->doLoadTableDescr($table)) {
 				$languageService->loadSingleTableDescription($table);
 			}
 			// Get the current "type" value for the record.
@@ -877,7 +586,7 @@ class FormEngine {
 					$excludeElements = ($this->excludeElements = $this->getExcludeElements($table, $row, $typeNum));
 					$fields = $this->mergeFieldsWithAddedFields($fields, $this->getFieldsToAdd($table, $row, $typeNum), $table);
 					// If TCEforms will render a tab menu in the next step, push the name to the tab stack:
-					if (strstr($itemList, '--div--') !== FALSE && $this->enableTabMenu) {
+					if (strstr($itemList, '--div--') !== FALSE) {
 						$tabIdentString = 'TCEforms:' . $table . ':' . $row['uid'];
 						$tabIdentStringMD5 = $this->getDocumentTemplate()->getDynTabMenuId($tabIdentString);
 						// Remember that were currently working on the general tab:
@@ -911,18 +620,16 @@ class FormEngine {
 								$out_array[$out_sheet][$out_pointer] .= $sField;
 							} elseif ($theField == '--div--') {
 								if ($cc > 0) {
-									if ($this->enableTabMenu) {
-										// Remove last tab entry from the dynNestedStack:
-										$out_sheet++;
-										// Remove the previous sheet from stack (if any):
-										$this->popFromDynNestedStack('tab', $tabIdentStringMD5 . '-' . $out_sheet);
-										// 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'] = $languageService->sL($fieldLabel);
-										// Register newline for Tab
-										$out_array_meta[$out_sheet]['newline'] = $additionalPalette == 'newline';
-									}
+									// Remove last tab entry from the dynNestedStack:
+									$out_sheet++;
+									// Remove the previous sheet from stack (if any):
+									$this->popFromDynNestedStack('tab', $tabIdentStringMD5 . '-' . $out_sheet);
+									// 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'] = $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'] = $languageService->sL($fieldLabel);
@@ -998,7 +705,6 @@ class FormEngine {
 		if ($out_sheet === 0) {
 			$output = '<div class="tab-content">' . $output . '</div>';
 		}
-		$output = $output;
 
 		return $output;
 	}
@@ -1014,7 +720,7 @@ class FormEngine {
 	 * @return string TCEform elements in a string.
 	 */
 	public function getListedFields($table, $row, $list) {
-		if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) {
+		if ($this->doLoadTableDescr($table)) {
 			$this->getLanguageService()->loadSingleTableDescription($table);
 		}
 		$out = '';
@@ -1049,9 +755,6 @@ class FormEngine {
 	 * @return string HTML code.
 	 */
 	public function getPaletteFields($table, $row, $palette, $header = '', $itemList = '', $collapsedHeader = NULL) {
-		if (!$this->doPrintPalette) {
-			return '';
-		}
 		$out = '';
 		$parts = $this->loadPaletteElements($table, $row, $palette, $itemList);
 		// Put palette together if there are fields in it:
@@ -1101,6 +804,8 @@ class FormEngine {
 	 * @return mixed String (normal) or array (palettes)
 	 */
 	public function getSingleField($table, $field, $row, $altName = '', $palette = FALSE, $extra = '', $pal = 0) {
+		$backendUser = $this->getBackendUserAuthentication();
+
 		// Hook: getSingleField_preProcess
 		foreach ($this->hookObjectsSingleField as $hookObj) {
 			if (method_exists($hookObj, 'getSingleField_preProcess')) {
@@ -1123,27 +828,27 @@ class FormEngine {
 		// Evaluate display condition
 		$displayConditionResult = TRUE;
 		if (is_array($PA['fieldConf']) && $PA['fieldConf']['displayCond'] && is_array($row)) {
-			/** @var $elementConditionMatcher \TYPO3\CMS\Backend\Form\ElementConditionMatcher */
-			$elementConditionMatcher = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\ElementConditionMatcher::class);
+			/** @var $elementConditionMatcher ElementConditionMatcher */
+			$elementConditionMatcher = GeneralUtility::makeInstance(ElementConditionMatcher::class);
 			$displayConditionResult = $elementConditionMatcher->match($PA['fieldConf']['displayCond'], $row);
 		}
 		// Check if this field is configured and editable (according to excludefields + other configuration)
 		if (
 			is_array($PA['fieldConf'])
 			&& !$skipThisField
-			&& (!$PA['fieldConf']['exclude'] || $this->getBackendUserAuthentication()->check('non_exclude_fields', $table . ':' . $field))
+			&& (!$PA['fieldConf']['exclude'] || $backendUser->check('non_exclude_fields', $table . ':' . $field))
 			&& $PA['fieldConf']['config']['form_type'] != 'passthrough'
-			&& ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE'])
+			&& ($backendUser->isRTE() || !$PA['fieldConf']['config']['showIfRTE'])
 			&& $displayConditionResult
 			&& (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || ($PA['fieldConf']['l10n_mode'] !== 'exclude') || $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0)
 			&& (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode === $PA['fieldConf']['l10n_cat'])
 		) {
 			// Fetching the TSconfig for the current table/field. This includes the $row which means that
-			$PA['fieldTSConfig'] = $this->setTSconfig($table, $row, $field);
+			$PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($table, $row, $field);
 			// If the field is NOT disabled from TSconfig (which it could have been) then render it
 			if (!$PA['fieldTSConfig']['disabled']) {
 				// Override fieldConf by fieldTSconfig:
-				$PA['fieldConf']['config'] = $this->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
+				$PA['fieldConf']['config'] = FormEngineUtility::overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
 				// Init variables:
 				$PA['itemFormElName'] = $this->prependFormFieldNames . '[' . $table . '][' . $row['uid'] . '][' . $field . ']';
 				// Form field name, in case of file uploads
@@ -1171,7 +876,7 @@ class FormEngine {
 					|| !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'])
 					&& GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
 				) {
-					if ($this->getBackendUserAuthentication()->jsConfirmation(1)) {
+					if ($backendUser->jsConfirmation(1)) {
 						$alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
 					} else {
 						$alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
@@ -1185,8 +890,6 @@ class FormEngine {
 				} else {
 					$languageService = $this->getLanguageService();
 					// Render as a normal field:
-					// onFocus attribute to add to the field:
-					$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.'][$languageService->lang] ?: $PA['label'];
@@ -1219,7 +922,7 @@ class FormEngine {
 					// If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in alt_doc.php
 					$label = htmlspecialchars($PA['label'], ENT_COMPAT, 'UTF-8', FALSE);
 					if (MathUtility::canBeInterpretedAsInteger($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !GeneralUtility::_GP('columnsOnly')) {
-						$lTTS_url = $this->backPath . 'alt_doc.php?edit[' . $table . '][' . $row['uid'] . ']=edit&columnsOnly=' . $field . '&returnUrl=' . rawurlencode($this->thisReturnUrl());
+						$lTTS_url = 'alt_doc.php?edit[' . $table . '][' . $row['uid'] . ']=edit&columnsOnly=' . $field . '&returnUrl=' . rawurlencode($this->thisReturnUrl());
 						$label = '<a href="' . htmlspecialchars($lTTS_url) . '">' . $label . '</a>';
 					}
 
@@ -1231,6 +934,11 @@ class FormEngine {
 						$this->additionalJS_post[] = 'typo3form.fieldTogglePlaceholder('
 							. GeneralUtility::quoteJSvalue($PA['itemFormElName']) . ', ' . ($checked ? 'false' : 'true') . ');';
 
+						$noneElement = GeneralUtility::makeInstance(NoneElement::class, $this);
+						$noneElementConfiguration = $PA;
+						$noneElementConfiguration['itemFormElValue'] = GeneralUtility::fixed_lgd_cs($placeholder, 30);
+						$noneElementHtml = $noneElement->render('', '', '', $noneElementConfiguration);
+
 						$item = '
 							<input type="hidden" name="' . htmlspecialchars($PA['itemFormElNameActive']) . '" value="0" />
 							<div class="checkbox">
@@ -1240,7 +948,7 @@ class FormEngine {
 								</label>
 							</div>
 							<div class="t3js-formengine-placeholder-placeholder">
-								' . $this->getSingleField_typeNone_render($PA['fieldConf']['config'], GeneralUtility::fixed_lgd_cs($placeholder, 30)) . '
+								' . $noneElementHtml . '
 							</div>
 							<div class="t3js-formengine-placeholder-formfield">' . $item . '</div>';
 					}
@@ -1280,8 +988,6 @@ class FormEngine {
 						';
 					}
 				}
-			} else {
-				$this->commentMessages[] = $this->prependFormFieldNames . '[' . $table . '][' . $row['uid'] . '][' . $field . ']: Disabled by TSconfig';
 			}
 		}
 		// Hook: getSingleField_postProcess
@@ -1335,34 +1041,33 @@ class FormEngine {
 			}
 			$formElement = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\Element\\' . $typeClassNameMapping[$type], $this);
 			if ($formElement instanceof AbstractFormElement) {
-				$formElement->setRenderReadonly($this->getRenderReadonly());
+				$formElement->setGlobalOptions($this->getConfigurationOptionsForChildElements());
 			}
 			$item = $formElement->render($table, $field, $row, $PA);
 		}
 		return $item;
 	}
 
+	/**
+	 * Returns an array of global form settings to be given to child elements.
+	 *
+	 * @return array
+	 */
+	protected function getConfigurationOptionsForChildElements() {
+		return array(
+			'renderReadonly' => $this->getRenderReadonly(),
+			'disabledWizards' => $this->disableWizards,
+			'returnUrl' => $this->thisReturnUrl(),
+			// Inline is handed over temporarily until FormEngine uses a real object tree
+			'inline' => $this->inline,
+		);
+	}
+
 	/**********************************************************
 	 *
 	 * Rendering of each TCEform field type
 	 *
 	 ************************************************************/
-	/**
-	 * Generation of TCEform elements of the type "input"
-	 * This will render a single-line input form field, possibly with various control/validation features
-	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\InputElement
-	 */
-	public function getSingleField_typeInput($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\InputElement::class, $this)
-			->render($table, $field, $row, $PA);
-	}
 
 	/**
 	 * Renders a view widget to handle and activate NULL values.
@@ -1423,3468 +1128,2850 @@ class FormEngine {
 		return $result;
 	}
 
-	/**
-	 * Generation of TCEform elements of the type "text"
-	 * This will render a <textarea> OR RTE area form field, possibly with various control/validation features
-	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\TextElement
-	 */
-	public function getSingleField_typeText($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\TextElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
-	}
 
+	/************************************************************
+	 *
+	 * "Configuration" fetching/processing functions
+	 *
+	 ************************************************************/
 	/**
-	 * Generation of TCEform elements of the type "check"
-	 * This will render a check-box OR an array of checkboxes
+	 * Calculate and return the current "types" pointer value for a record
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\CheckboxElement
+	 * @param string $table The table name. MUST be in $GLOBALS['TCA']
+	 * @param array $row The row from the table, should contain at least the "type" field, if applicable.
+	 * @return string Return the "type" value for this record, ready to pick a "types" configuration from the $GLOBALS['TCA'] array.
+	 * @throws \RuntimeException
 	 */
-	public function getSingleField_typeCheck($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\CheckboxElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function getRTypeNum($table, $row) {
+		$typeNum = 0;
+		$field = $GLOBALS['TCA'][$table]['ctrl']['type'];
+		if ($field) {
+			if (strpos($field, ':') !== FALSE) {
+				list($pointerField, $foreignTypeField) = explode(':', $field);
+				$fieldConfig = $GLOBALS['TCA'][$table]['columns'][$pointerField]['config'];
+				$relationType = $fieldConfig['type'];
+				if ($relationType === 'select') {
+					$foreignUid = $row[$pointerField];
+					$foreignTable = $fieldConfig['foreign_table'];
+				} elseif ($relationType === 'group') {
+					$values = FormEngineUtility::extractValuesOnlyFromValueLabelList($row[$pointerField]);
+					list(, $foreignUid) = GeneralUtility::revExplode('_', $values[0], 2);
+					$allowedTables = explode(',', $fieldConfig['allowed']);
+					// Always take the first configured table.
+					$foreignTable = $allowedTables[0];
+				} else {
+					throw new \RuntimeException('TCA Foreign field pointer fields are only allowed to be used with group or select field types.', 1325861239);
+				}
+				if ($foreignUid) {
+					$foreignRow = BackendUtility::getRecord($foreignTable, $foreignUid, $foreignTypeField);
+					$this->registerDefaultLanguageData($foreignTable, $foreignRow);
+					if ($foreignRow[$foreignTypeField]) {
+						$foreignTypeFieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
+						$typeNum = $this->getLanguageOverlayRawValue($foreignTable, $foreignRow, $foreignTypeField, $foreignTypeFieldConfig);
+					}
+				}
+			} else {
+				$typeFieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
+				$typeNum = $this->getLanguageOverlayRawValue($table, $row, $field, $typeFieldConfig);
+			}
+		}
+		if (empty($typeNum)) {
+			// If that value is an empty string, set it to "0" (zero)
+			$typeNum = 0;
+		}
+		// If current typeNum doesn't exist, set it to 0 (or to 1 for historical reasons, if 0 doesn't exist)
+		if (!$GLOBALS['TCA'][$table]['types'][$typeNum]) {
+			$typeNum = $GLOBALS['TCA'][$table]['types']['0'] ? 0 : 1;
+		}
+		// Force to string. Necessary for eg '-1' to be recognized as a type value.
+		$typeNum = (string)$typeNum;
+		return $typeNum;
 	}
 
 	/**
-	 * Generation of TCEform elements of the type "radio"
-	 * This will render a series of radio buttons.
+	 * Used to adhoc-rearrange the field order normally set in the [types][showitem] list
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\RadioElement
+	 * @param array $fields A [types][showitem] list of fields, exploded by ",
+	 * @return array Returns rearranged version (keys are changed around as well.)
+	 * @see getMainFields()
 	 */
-	public function getSingleField_typeRadio($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\RadioElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function rearrange($fields) {
+		$fO = array_flip(GeneralUtility::trimExplode(',', $this->fieldOrder, TRUE));
+		$newFields = array();
+		foreach ($fields as $cc => $content) {
+			$cP = GeneralUtility::trimExplode(';', $content);
+			if (isset($fO[$cP[0]])) {
+				$newFields[$fO[$cP[0]]] = $content;
+				unset($fields[$cc]);
+			}
+		}
+		ksort($newFields);
+		$fields = array_merge($newFields, $fields);
+		return $fields;
 	}
 
 	/**
-	 * Generation of TCEform elements of the type "select"
-	 * This will render a selector box element, or possibly a special construction with two selector boxes.
-	 * That depends on configuration.
+	 * Producing an array of field names NOT to display in the form,
+	 * based on settings from subtype_value_field, bitmask_excludelist_bits etc.
+	 * Notice, this list is in NO way related to the "excludeField" flag
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\SelectElement
+	 * @param string $table Table name, MUST be in $GLOBALS['TCA']
+	 * @param array $row A record from table.
+	 * @param string $typeNum A "type" pointer value, probably the one calculated based on the record array.
+	 * @return array Array with fieldnames as values. The fieldnames are those which should NOT be displayed "anyways
+	 * @see getMainFields()
 	 */
-	public function getSingleField_typeSelect($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\SelectElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function getExcludeElements($table, $row, $typeNum) {
+		// Init:
+		$excludeElements = array();
+		// If a subtype field is defined for the type
+		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
+			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
+			if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) {
+				$excludeElements = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]], TRUE);
+			}
+		}
+		// If a bitmask-value field has been configured, then find possible fields to exclude based on that:
+		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field']) {
+			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field'];
+			$sTValue = MathUtility::forceIntegerInRange($row[$sTfield], 0);
+			if (is_array($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'])) {
+				foreach ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) {
+					$bit = substr($bitKey, 1);
+					if (MathUtility::canBeInterpretedAsInteger($bit)) {
+						$bit = MathUtility::forceIntegerInRange($bit, 0, 30);
+						if ($bitKey[0] === '-' && !($sTValue & pow(2, $bit)) || $bitKey[0] === '+' && $sTValue & pow(2, $bit)) {
+							$excludeElements = array_merge($excludeElements, GeneralUtility::trimExplode(',', $eList, TRUE));
+						}
+					}
+				}
+			}
+		}
+		// Return the array of elements:
+		return $excludeElements;
 	}
 
 	/**
-	 * Generation of TCEform elements of the type "group"
-	 * This will render a selectorbox into which elements from either the file system or database can be inserted. Relations.
+	 * Finds possible field to add to the form, based on subtype fields.
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since 7.0 - will be removed two versions later; Use \TYPO3\CMS\Backend\Form\Element\GroupElement
+	 * @param string $table Table name, MUST be in $GLOBALS['TCA']
+	 * @param array $row A record from table.
+	 * @param string $typeNum A "type" pointer value, probably the one calculated based on the record array.
+	 * @return array An array containing two values: 1) Another array containing field names to add and 2) the subtype value field.
+	 * @see getMainFields()
 	 */
-	public function getSingleField_typeGroup($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\GroupElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function getFieldsToAdd($table, $row, $typeNum) {
+		// Init:
+		$addElements = array();
+		// If a subtype field is defined for the type
+		$sTfield = '';
+		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
+			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
+			if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) {
+				$addElements = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]], TRUE);
+			}
+		}
+		// Return the return
+		return array($addElements, $sTfield);
 	}
 
 	/**
-	 * Generation of TCEform elements of the type "none"
-	 * This will render a non-editable display of the content of the field.
+	 * Merges the current [types][showitem] array with the array of fields to add for the current subtype field of the "type" value.
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\NoneElement
+	 * @param array $fields A [types][showitem] list of fields, exploded by ",
+	 * @param array $fieldsToAdd The output from getFieldsToAdd()
+	 * @param string $table The table name, if we want to consider it's palettes when positioning the new elements
+	 * @return array Return the modified $fields array.
+	 * @see getMainFields(),getFieldsToAdd()
 	 */
-	public function getSingleField_typeNone($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\NoneElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function mergeFieldsWithAddedFields($fields, $fieldsToAdd, $table = '') {
+		if (count($fieldsToAdd[0])) {
+			$c = 0;
+			$found = FALSE;
+			foreach ($fields as $fieldInfo) {
+				list($fieldName, $label, $paletteName) = GeneralUtility::trimExplode(';', $fieldInfo);
+				if ($fieldName === $fieldsToAdd[1]) {
+					$found = TRUE;
+				} elseif ($fieldName === '--palette--' && $paletteName && $table !== '') {
+					// Look inside the palette
+					if (is_array($GLOBALS['TCA'][$table]['palettes'][$paletteName])) {
+						$itemList = $GLOBALS['TCA'][$table]['palettes'][$paletteName]['showitem'];
+						if ($itemList) {
+							$paletteFields = GeneralUtility::trimExplode(',', $itemList, TRUE);
+							foreach ($paletteFields as $info) {
+								$fieldParts = GeneralUtility::trimExplode(';', $info);
+								$theField = $fieldParts[0];
+								if ($theField === $fieldsToAdd[1]) {
+									$found = TRUE;
+									break 1;
+								}
+							}
+						}
+					}
+				}
+				if ($found) {
+					array_splice($fields, $c + 1, 0, $fieldsToAdd[0]);
+					break;
+				}
+				$c++;
+			}
+		}
+		return $fields;
 	}
 
 	/**
-	 * HTML rendering of a value which is not editable.
+	 * Loads the elements of a palette (collection of secondary options) in an array.
 	 *
-	 * @param array $config Configuration for the display
-	 * @param string $itemValue The value to display
-	 * @return string The HTML code for the display
-	 * @see getSingleField_typeNone();
+	 * @param string $table The table name
+	 * @param array $row The row array
+	 * @param string $palette The palette number/pointer
+	 * @param string $itemList Optional alternative list of fields for the palette
+	 * @return array The palette elements
 	 */
-	public function getSingleField_typeNone_render($config, $itemValue) {
-		if ($config['format']) {
-			$itemValue = $this->formatValue($config, $itemValue);
-		}
-		if (!$config['pass_content']) {
-			$itemValue = htmlspecialchars($itemValue);
+	public function loadPaletteElements($table, $row, $palette, $itemList = '') {
+		$parts = array();
+		// Getting excludeElements, if any.
+		if (!is_array($this->excludeElements)) {
+			$this->excludeElements = $this->getExcludeElements($table, $row, $this->getRTypeNum($table, $row));
 		}
-
-		$rows = (int)$config['rows'];
-		// Render as textarea
-		if ($rows > 1 || $config['type'] === 'text') {
-			if (!$config['pass_content']) {
-				$itemValue = nl2br($itemValue);
+		// Load the palette TCEform elements
+		if ($GLOBALS['TCA'][$table] && (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) || $itemList)) {
+			$itemList = $itemList ? $itemList : $GLOBALS['TCA'][$table]['palettes'][$palette]['showitem'];
+			if ($itemList) {
+				$fields = GeneralUtility::trimExplode(',', $itemList, TRUE);
+				foreach ($fields as $info) {
+					$fieldParts = GeneralUtility::trimExplode(';', $info);
+					$theField = $fieldParts[0];
+					if ($theField === '--linebreak--') {
+						$parts[]['NAME'] = '--linebreak--';
+					} elseif (!in_array($theField, $this->excludeElements) && $GLOBALS['TCA'][$table]['columns'][$theField]) {
+						$elem = $this->getSingleField($table, $theField, $row, $fieldParts[1], 1, '', $fieldParts[2]);
+						if (is_array($elem)) {
+							$parts[] = $elem;
+						}
+					}
+				}
 			}
-			$cols = MathUtility::forceIntegerInRange($config['cols'] ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
-			$width = $this->formMaxWidth($cols);
-			$item = '
-				<div class="form-control-wrap"' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>
-					<textarea class="form-control" rows="' . $rows . '" disabled>' . $itemValue . '</textarea>
-				</div>';
-		} else {
-			$cols = $config['cols'] ?: ($config['size'] ?: $this->defaultInputWidth);
-			$size = MathUtility::forceIntegerInRange($cols ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
-			$width = $this->formMaxWidth($size);
-			$item = '
-				<div class="form-control-wrap"' . ($width ? ' style="max-width: ' . $width . 'px"' : '') . '>
-					<input class="form-control" value="'. $itemValue .'" type="text" disabled>
-				</div>
-				' . ((string)$itemValue !== '' ? '<p class="help-block">' . $itemValue . '</p>' : '');
 		}
-		return $item;
+		return $parts;
 	}
 
-	/**
-	 * Handler for Flex Forms
+	/************************************************************
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\FlexElement
-	 */
-	public function getSingleField_typeFlex($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\FlexElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
-	}
-
+	 * Display of localized content etc.
+	 *
+	 ************************************************************/
 	/**
-	 * Creates the language menu for FlexForms:
+	 * Will register data from original language records if the current record is a translation of another.
+	 * The original data is shown with the edited record in the form.
+	 * The information also includes possibly diff-views of what changed in the original record.
+	 * Function called from outside (see alt_doc.php + quick edit) before rendering a form for a record
 	 *
-	 * @param array $languages
-	 * @param string $elName
-	 * @param array $selectedLanguage
-	 * @param bool $multi
-	 * @return string HTML for menu
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param string $table Table name of the record being edited
+	 * @param array $rec Record array of the record being edited
+	 * @return void
 	 */
-	public function getSingleField_typeFlex_langMenu($languages, $elName, $selectedLanguage, $multi = TRUE) {
-		GeneralUtility::logDeprecatedFunction();
-		$opt = array();
-		foreach ($languages as $lArr) {
-			$opt[] = '<option value="' . htmlspecialchars($lArr['ISOcode']) . '"'
-				. (in_array($lArr['ISOcode'], $selectedLanguage) ? ' selected="selected"' : '') . '>'
-				. htmlspecialchars($lArr['title']) . '</option>';
+	public function registerDefaultLanguageData($table, $rec) {
+		// Add default language:
+		if (
+			$GLOBALS['TCA'][$table]['ctrl']['languageField'] && $rec[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0
+			&& $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
+			&& (int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0
+		) {
+			$lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']
+				? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']
+				: $table;
+			// Get data formatted:
+			$this->defaultLanguageData[$table . ':' . $rec['uid']] = BackendUtility::getRecordWSOL(
+				$lookUpTable,
+				(int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]
+			);
+			// Get data for diff:
+			if ($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
+				$this->defaultLanguageData_diff[$table . ':' . $rec['uid']] = unserialize($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']]);
+			}
+			// If there are additional preview languages, load information for them also:
+			$prLang = $this->getAdditionalPreviewLanguages();
+			foreach ($prLang as $prL) {
+				/** @var $t8Tools TranslationConfigurationProvider */
+				$t8Tools = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
+				$tInfo = $t8Tools->translationInfo($lookUpTable, (int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], $prL['uid']);
+				if (is_array($tInfo['translations']) && is_array($tInfo['translations'][$prL['uid']])) {
+					$this->additionalPreviewLanguageData[$table . ':' . $rec['uid']][$prL['uid']] = BackendUtility::getRecordWSOL($table, (int)$tInfo['translations'][$prL['uid']]['uid']);
+				}
+			}
 		}
-		$output = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE))
-			. ' class="tceforms-select tceforms-multiselect tceforms-flexlangmenu" name="' . $elName . '[]"'
-			. ($multi ? ' multiple="multiple" size="' . count($languages) . '"' : '') . '>' . implode('', $opt)
-			. '</select>';
-		return $output;
 	}
 
 	/**
-	 * Creates the menu for selection of the sheets:
+	 * Creates language-overlay for a field value
+	 * This means the requested field value will be overridden with the data from the default language.
+	 * Can be used to render read only fields for example.
 	 *
-	 * @param array $sArr Sheet array for which to render the menu
-	 * @param string $elName Form element name of the field containing the sheet pointer
-	 * @param string $sheetKey Current sheet key
-	 * @return string HTML for menu
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param string $table Table name of the record being edited
+	 * @param array $row Record array of the record being edited in current language
+	 * @param string $field Field name represented by $item
+	 * @param array $fieldConf Content of $PA['fieldConf']
+	 * @return string Unprocessed field value merged with default language data if needed
 	 */
-	public function getSingleField_typeFlex_sheetMenu($sArr, $elName, $sheetKey) {
-		GeneralUtility::logDeprecatedFunction();
-		$tCells = array();
-		$pct = round(100 / count($sArr));
-		foreach ($sArr as $sKey => $sheetCfg) {
-			if ($this->getBackendUserAuthentication()->jsConfirmation(1)) {
-				$onClick = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){'
-					. $this->elName($elName) . '.value=\'' . $sKey . '\'; TBE_EDITOR.submitForm()};';
-			} else {
-				$onClick = 'if(TBE_EDITOR.checkSubmit(-1)){ ' . $this->elName($elName) . '.value=\'' . $sKey . '\'; TBE_EDITOR.submitForm();}';
+	public function getLanguageOverlayRawValue($table, $row, $field, $fieldConf) {
+		$value = $row[$field];
+		if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
+			if (
+				$fieldConf['l10n_mode'] == 'exclude'
+				|| $fieldConf['l10n_mode'] == 'mergeIfNotBlank' && trim($this->defaultLanguageData[$table . ':' . $row['uid']][$field]) !== ''
+			) {
+				$value = $this->defaultLanguageData[$table . ':' . $row['uid']][$field];
 			}
-			$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->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>';
+		return $value;
 	}
 
 	/**
-	 * Handler for unknown types.
+	 * Renders the display of default language record content around current field.
+	 * Will render content if any is found in the internal array, $this->defaultLanguageData,
+	 * depending on registerDefaultLanguageData() being called prior to this.
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\UnknownElement
+	 * @param string $table Table name of the record being edited
+	 * @param string $field Field name represented by $item
+	 * @param array $row Record array of the record being edited
+	 * @param string $item 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()
 	 */
-	public function getSingleField_typeUnknown($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\UnknownElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function renderDefaultLanguageContent($table, $field, $row, $item) {
+		if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
+			$defaultLanguageValue = BackendUtility::getProcessedValue($table, $field, $this->defaultLanguageData[$table . ':' . $row['uid']][$field], 0, 1, FALSE, $this->defaultLanguageData[$table . ':' . $row['uid']]['uid']);
+			$fieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
+			// Don't show content if it's for IRRE child records:
+			if ($fieldConfig['config']['type'] != 'inline') {
+				if ($defaultLanguageValue !== '') {
+					$item .= '<div class="t3-form-original-language">' . FormEngineUtility::getLanguageIcon($table, $row, 0)
+						. $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
+						. $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
+				}
+				$previewLanguages = $this->getAdditionalPreviewLanguages();
+				foreach ($previewLanguages as $previewLanguage) {
+					$defaultLanguageValue = BackendUtility::getProcessedValue($table, $field, $this->additionalPreviewLanguageData[$table . ':' . $row['uid']][$previewLanguage['uid']][$field], 0, 1);
+					if ($defaultLanguageValue !== '') {
+						$item .= '<div class="t3-form-original-language">'
+							. FormEngineUtility::getLanguageIcon($table, $row, ('v' . $previewLanguage['ISOcode']))
+							. $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
+							. $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
+					}
+				}
+			}
+		}
+		return $item;
 	}
 
 	/**
-	 * User defined field type
+	 * Renders the diff-view of default language record content compared with what the record was originally translated from.
+	 * Will render content if any is found in the internal array, $this->defaultLanguageData,
+	 * depending on registerDefaultLanguageData() being called prior to this.
 	 *
-	 * @param string $table The table name of the record
-	 * @param string $field The field name which this element is supposed to edit
-	 * @param array $row The record data array where the value(s) for the field can be found
-	 * @param array $PA An array with additional configuration options.
-	 * @return string The HTML code for the TCEform field
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\UserElement
+	 * @param string $table Table name of the record being edited
+	 * @param string $field Field name represented by $item
+	 * @param array $row Record array of the record being edited
+	 * @param string  $item 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()
 	 */
-	public function getSingleField_typeUser($table, $field, $row, &$PA) {
-		GeneralUtility::logDeprecatedFunction();
-		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\UserElement::class, $this)
-			->setRenderReadonly($this->getRenderReadonly())
-			->render($table, $field, $row, $PA);
+	public function renderDefaultLanguageDiff($table, $field, $row, $item) {
+		if (is_array($this->defaultLanguageData_diff[$table . ':' . $row['uid']])) {
+			// Initialize:
+			$dLVal = array(
+				'old' => $this->defaultLanguageData_diff[$table . ':' . $row['uid']],
+				'new' => $this->defaultLanguageData[$table . ':' . $row['uid']]
+			);
+			// There must be diff-data:
+			if (isset($dLVal['old'][$field])) {
+				if ((string)$dLVal['old'][$field] !== (string)$dLVal['new'][$field]) {
+					// Create diff-result:
+					$t3lib_diff_Obj = GeneralUtility::makeInstance(DiffUtility::class);
+					$diffres = $t3lib_diff_Obj->makeDiffDisplay(
+						BackendUtility::getProcessedValue($table, $field, $dLVal['old'][$field], 0, 1),
+						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-diffcontent">' . $diffres . '</div>
+					</div>';
+				}
+			}
+		}
+		return $item;
 	}
 
 	/************************************************************
 	 *
-	 * Field content processing
+	 * Form element helper functions
 	 *
 	 ************************************************************/
 	/**
-	 * Format field content of various types if $config['format'] is set to date, filesize, ..., user
-	 * This is primarily for the field type none but can be used for user field types for example
+	 * Creates style attribute content for optgroup tags in a selector box, primarily setting it
+	 * up to show the icon of an element as background image (works in mozilla).
 	 *
-	 * @param array $config Configuration for the display
-	 * @param string $itemValue The value to display
-	 * @return string Formatted Field content
+	 * @param string $iconString Icon string for option item
+	 * @return string Style attribute content, if any
 	 */
-	public function formatValue($config, $itemValue) {
-		$format = trim($config['format']);
-		switch ($format) {
-			case 'date':
-				if ($itemValue) {
-					$option = trim($config['format.']['option']);
-					if ($option) {
-						if ($config['format.']['strftime']) {
-							$value = strftime($option, $itemValue);
-						} else {
-							$value = date($option, $itemValue);
-						}
-					} else {
-						$value = date('d-m-Y', $itemValue);
-					}
-				} else {
-					$value = '';
-				}
-				if ($config['format.']['appendAge']) {
-					$age = BackendUtility::calcAge(
-						$GLOBALS['EXEC_TIME'] - $itemValue,
-						$this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
-					);
-					$value .= ' (' . $age . ')';
-				}
-				$itemValue = $value;
-				break;
-			case 'datetime':
-				// compatibility with "eval" (type "input")
-				if ($itemValue !== '') {
-					$itemValue = date('H:i d-m-Y', (int)$itemValue);
-				}
-				break;
-			case 'time':
-				// compatibility with "eval" (type "input")
-				if ($itemValue !== '') {
-					$itemValue = date('H:i', (int)$itemValue);
-				}
-				break;
-			case 'timesec':
-				// compatibility with "eval" (type "input")
-				if ($itemValue !== '') {
-					$itemValue = date('H:i:s', (int)$itemValue);
-				}
-				break;
-			case 'year':
-				// compatibility with "eval" (type "input")
-				if ($itemValue !== '') {
-					$itemValue = date('Y', (int)$itemValue);
-				}
-				break;
-			case 'int':
-				$baseArr = array('dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b');
-				$base = trim($config['format.']['base']);
-				$format = $baseArr[$base] ?: 'd';
-				$itemValue = sprintf('%' . $format, $itemValue);
-				break;
-			case 'float':
-				$precision = MathUtility::forceIntegerInRange($config['format.']['precision'], 1, 10, 2);
-				$itemValue = sprintf('%.' . $precision . 'f', $itemValue);
-				break;
-			case 'number':
-				$format = trim($config['format.']['option']);
-				$itemValue = sprintf('%' . $format, $itemValue);
-				break;
-			case 'md5':
-				$itemValue = md5($itemValue);
-				break;
-			case 'filesize':
-				// We need to cast to int here, otherwise empty values result in empty output,
-				// but we expect zero.
-				$value = GeneralUtility::formatSize((int)$itemValue);
-				if ($config['format.']['appendByteSize']) {
-					$value .= ' (' . $itemValue . ')';
-				}
-				$itemValue = $value;
-				break;
-			case 'user':
-				$func = trim($config['format.']['userFunc']);
-				if ($func) {
-					$params = array(
-						'value' => $itemValue,
-						'args' => $config['format.']['userFunc'],
-						'config' => $config,
-						'pObj' => &$this
-					);
-					$itemValue = GeneralUtility::callUserFunction($func, $params, $this);
-				}
-				break;
-			default:
-				// Do nothing e.g. when $format === ''
+	public function optgroupTagStyle($iconString) {
+		if (!$iconString) {
+			return '';
 		}
-		return $itemValue;
+		list($selIconFile, $selIconInfo) = FormEngineUtility::getIcon($iconString);
+		if (empty($selIconFile)) {
+			// Skip background style if image is unavailable
+			return '';
+		}
+		$padLeft = $selIconInfo[0] + 4;
+		if ($padLeft >= 18 && $padLeft <= 24) {
+			// In order to get the same padding for all option tags even if icon sizes differ a little,
+			// set it to 22, if it was between 18 and 24 pixels.
+			$padLeft = 22;
+		}
+		$padTop = MathUtility::forceIntegerInRange(($selIconInfo[1] - 12) / 2, 0);
+		return 'background: #ffffff url(' . $selIconFile . ') 0 0 no-repeat; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;';
 	}
 
-	/************************************************************
-	 *
-	 * "Configuration" fetching/processing functions
+	/**
+	 * Add the id and the style property to the field palette
 	 *
-	 ************************************************************/
+	 * @param string $code Palette Code
+	 * @param string $id Collapsible ID
+	 * @param string $collapsed Collapsed status
+	 * @return bool Is collapsed
+	 */
+	public function wrapCollapsiblePalette($code, $id, $collapsed) {
+		$display = $collapsed ? '' : ' in';
+		$id = str_replace('.', '', $id);
+		$out = '
+			<!-- wrapCollapsiblePalette -->
+			<p>
+				<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#' . $id . '" aria-expanded="false" aria-controls="' . $id . '">
+					' . IconUtility::getSpriteIcon('actions-system-options-view') . '
+					' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.moreOptions')) . '
+				</button>
+			</p>
+			<div id="' . $id . '" class="form-section-collapse collapse' . $display . '">
+				<div class="row">' . $code . '</div>
+			</div>';
+		return $out;
+	}
+
+
 	/**
-	 * Calculate and return the current "types" pointer value for a record
+	 * Returns the "returnUrl" of the form. Can be set externally or will be taken from "GeneralUtility::linkThisScript()"
 	 *
-	 * @param string $table The table name. MUST be in $GLOBALS['TCA']
-	 * @param array $row The row from the table, should contain at least the "type" field, if applicable.
-	 * @return string Return the "type" value for this record, ready to pick a "types" configuration from the $GLOBALS['TCA'] array.
-	 * @throws \RuntimeException
+	 * @return string Return URL of current script
 	 */
-	public function getRTypeNum($table, $row) {
-		$typeNum = 0;
-		$field = $GLOBALS['TCA'][$table]['ctrl']['type'];
-		if ($field) {
-			if (strpos($field, ':') !== FALSE) {
-				list($pointerField, $foreignTypeField) = explode(':', $field);
-				$fieldConfig = $GLOBALS['TCA'][$table]['columns'][$pointerField]['config'];
-				$relationType = $fieldConfig['type'];
-				if ($relationType === 'select') {
-					$foreignUid = $row[$pointerField];
-					$foreignTable = $fieldConfig['foreign_table'];
-				} elseif ($relationType === 'group') {
-					$values = $this->extractValuesOnlyFromValueLabelList($row[$pointerField]);
-					list(, $foreignUid) = GeneralUtility::revExplode('_', $values[0], 2);
-					$allowedTables = explode(',', $fieldConfig['allowed']);
-					// Always take the first configured table.
-					$foreignTable = $allowedTables[0];
-				} else {
-					throw new \RuntimeException('TCA Foreign field pointer fields are only allowed to be used with group or select field types.', 1325861239);
-				}
-				if ($foreignUid) {
-					$foreignRow = BackendUtility::getRecord($foreignTable, $foreignUid, $foreignTypeField);
-					$this->registerDefaultLanguageData($foreignTable, $foreignRow);
-					if ($foreignRow[$foreignTypeField]) {
-						$foreignTypeFieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
-						$typeNum = $this->getLanguageOverlayRawValue($foreignTable, $foreignRow, $foreignTypeField, $foreignTypeFieldConfig);
-					}
-				}
-			} else {
-				$typeFieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
-				$typeNum = $this->getLanguageOverlayRawValue($table, $row, $field, $typeFieldConfig);
-			}
-		}
-		if (empty($typeNum)) {
-			// If that value is an empty string, set it to "0" (zero)
-			$typeNum = 0;
-		}
-		// If current typeNum doesn't exist, set it to 0 (or to 1 for historical reasons, if 0 doesn't exist)
-		if (!$GLOBALS['TCA'][$table]['types'][$typeNum]) {
-			$typeNum = $GLOBALS['TCA'][$table]['types']['0'] ? 0 : 1;
-		}
-		// Force to string. Necessary for eg '-1' to be recognized as a type value.
-		$typeNum = (string)$typeNum;
-		return $typeNum;
+	public function thisReturnUrl() {
+		return $this->returnUrl ? $this->returnUrl : GeneralUtility::linkThisScript();
 	}
 
 	/**
-	 * Used to adhoc-rearrange the field order normally set in the [types][showitem] list
+	 * Returns the form field for a single HIDDEN field.
+	 * (Not used anywhere...?)
 	 *
-	 * @param array $fields A [types][showitem] list of fields, exploded by ",
-	 * @return array Returns rearranged version (keys are changed around as well.)
-	 * @see getMainFields()
+	 * @param string $table Table name
+	 * @param string $field Field name
+	 * @param array $row The row
+	 * @return string The hidden-field <input> tag.
 	 */
-	public function rearrange($fields) {
-		$fO = array_flip(GeneralUtility::trimExplode(',', $this->fieldOrder, TRUE));
-		$newFields = array();
-		foreach ($fields as $cc => $content) {
-			$cP = GeneralUtility::trimExplode(';', $content);
-			if (isset($fO[$cP[0]])) {
-				$newFields[$fO[$cP[0]]] = $content;
-				unset($fields[$cc]);
-			}
+	public function getSingleHiddenField($table, $field, $row) {
+		$item = '';
+		if ($GLOBALS['TCA'][$table]['columns'][$field]) {
+			$uid = $row['uid'];
+			$itemName = $this->prependFormFieldNames . '[' . $table . '][' . $uid . '][' . $field . ']';
+			$itemValue = $row[$field];
+			$item = '<input type="hidden" name="' . $itemName . '" value="' . htmlspecialchars($itemValue) . '" />';
 		}
-		ksort($newFields);
-		$fields = array_merge($newFields, $fields);
-		return $fields;
+		return $item;
 	}
 
 	/**
-	 * Producing an array of field names NOT to display in the form,
-	 * based on settings from subtype_value_field, bitmask_excludelist_bits etc.
-	 * Notice, this list is in NO way related to the "excludeField" flag
+	 * Create dynamic tab menu
 	 *
-	 * @param string $table Table name, MUST be in $GLOBALS['TCA']
-	 * @param array $row A record from table.
-	 * @param string $typeNum A "type" pointer value, probably the one calculated based on the record array.
-	 * @return array Array with fieldnames as values. The fieldnames are those which should NOT be displayed "anyways
-	 * @see getMainFields()
+	 * @param array $parts Parts for the tab menu, fed to template::getDynTabMenu()
+	 * @param string $idString ID string for the tab menu
+	 * @param int $dividersToTabsBehaviour If set to '1' empty tabs will be removed, If set to '2' empty tabs will be disabled, deprecated, and not in use anymore since TYPO3 CMS 7
+	 * @return string HTML for the menu
 	 */
-	public function getExcludeElements($table, $row, $typeNum) {
-		// Init:
-		$excludeElements = array();
-		// If a subtype field is defined for the type
-		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
-			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
-			if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) {
-				$excludeElements = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]], TRUE);
-			}
+	public function getDynTabMenu($parts, $idString, $dividersToTabsBehaviour = -1) {
+		// if the third (obsolete) parameter is used, throw a deprecation warning
+		if ($dividersToTabsBehaviour !== -1) {
+			GeneralUtility::deprecationLog('The parameter $dividersToTabsBehaviour in FormEngine::getDynTabMenu is deprecated. Please remove this option from your code');
 		}
-		// If a bitmask-value field has been configured, then find possible fields to exclude based on that:
-		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field']) {
-			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field'];
-			$sTValue = MathUtility::forceIntegerInRange($row[$sTfield], 0);
-			if (is_array($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'])) {
-				foreach ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) {
-					$bit = substr($bitKey, 1);
-					if (MathUtility::canBeInterpretedAsInteger($bit)) {
-						$bit = MathUtility::forceIntegerInRange($bit, 0, 30);
-						if ($bitKey[0] === '-' && !($sTValue & pow(2, $bit)) || $bitKey[0] === '+' && $sTValue & pow(2, $bit)) {
-							$excludeElements = array_merge($excludeElements, GeneralUtility::trimExplode(',', $eList, TRUE));
-						}
-					}
-				}
+		$docTemplate = $this->getDocumentTemplate();
+		if (is_object($docTemplate)) {
+			$docTemplate->backPath = '';
+			return $docTemplate->getDynTabMenu($parts, $idString, 0, FALSE, 1, FALSE, 1);
+		} else {
+			$output = '';
+			foreach ($parts as $singlePad) {
+				$output .= '
+				<h3>' . htmlspecialchars($singlePad['label']) . '</h3>
+				' . ($singlePad['description'] ? '<p class="c-descr">' . nl2br(htmlspecialchars($singlePad['description'])) . '</p>' : '') . '
+				' . $singlePad['content'];
 			}
+			return '<div class="tab-content">' . $output . '</div>';
 		}
-		// Return the array of elements:
-		return $excludeElements;
 	}
 
+	/********************************************
+	 *
+	 * Template functions
+	 *
+	 ********************************************/
 	/**
-	 * Finds possible field to add to the form, based on subtype fields.
+	 * Sets the design to the backend design.
+	 * Backend
 	 *
-	 * @param string $table Table name, MUST be in $GLOBALS['TCA']
-	 * @param array $row A record from table.
-	 * @param string $typeNum A "type" pointer value, probably the one calculated based on the record array.
-	 * @return array An array containing two values: 1) Another array containing field names to add and 2) the subtype value field.
-	 * @see getMainFields()
+	 * @return void
 	 */
-	public function getFieldsToAdd($table, $row, $typeNum) {
-		// Init:
-		$addElements = array();
-		// If a subtype field is defined for the type
-		$sTfield = '';
-		if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
-			$sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
-			if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) {
-				$addElements = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]], TRUE);
-			}
-		}
-		// Return the return
-		return array($addElements, $sTfield);
+	public function setNewBEDesign() {
+		$template = GeneralUtility::getUrl(PATH_typo3 . $this->templateFile);
+		// Wrapping all table rows for a particular record being edited:
+		$this->totalWrap = HtmlParser::getSubpart($template, '###TOTALWRAP###');
+		// Wrapping a single field:
+		$this->fieldTemplate = HtmlParser::getSubpart($template, '###FIELDTEMPLATE###');
+		$this->paletteFieldTemplate = HtmlParser::getSubpart($template, '###PALETTEFIELDTEMPLATE###');
+		$this->palFieldTemplate = HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE###');
+		$this->palFieldTemplateHeader = HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE_HEADER###');
 	}
 
 	/**
-	 * Merges the current [types][showitem] array with the array of fields to add for the current subtype field of the "type" value.
+	 * This inserts the content of $inArr into the field-template
 	 *
-	 * @param array $fields A [types][showitem] list of fields, exploded by ",
-	 * @param array $fieldsToAdd The output from getFieldsToAdd()
-	 * @param string $table The table name, if we want to consider it's palettes when positioning the new elements
-	 * @return array Return the modified $fields array.
-	 * @see getMainFields(),getFieldsToAdd()
+	 * @param array $inArr Array with key/value pairs to insert in the template.
+	 * @param string $altTemplate Alternative template to use instead of the default.
+	 * @return string
 	 */
-	public function mergeFieldsWithAddedFields($fields, $fieldsToAdd, $table = '') {
-		if (count($fieldsToAdd[0])) {
-			$c = 0;
-			$found = FALSE;
-			foreach ($fields as $fieldInfo) {
-				list($fieldName, $label, $paletteName) = GeneralUtility::trimExplode(';', $fieldInfo);
-				if ($fieldName === $fieldsToAdd[1]) {
-					$found = TRUE;
-				} elseif ($fieldName === '--palette--' && $paletteName && $table !== '') {
-					// Look inside the palette
-					if (is_array($GLOBALS['TCA'][$table]['palettes'][$paletteName])) {
-						$itemList = $GLOBALS['TCA'][$table]['palettes'][$paletteName]['showitem'];
-						if ($itemList) {
-							$paletteFields = GeneralUtility::trimExplode(',', $itemList, TRUE);
-							foreach ($paletteFields as $info) {
-								$fieldParts = GeneralUtility::trimExplode(';', $info);
-								$theField = $fieldParts[0];
-								if ($theField === $fieldsToAdd[1]) {
-									$found = TRUE;
-									break 1;
-								}
-							}
-						}
-					}
-				}
-				if ($found) {
-					array_splice($fields, $c + 1, 0, $fieldsToAdd[0]);
-					break;
-				}
-				$c++;
-			}
+	public function intoTemplate($inArr, $altTemplate = '') {
+		// Put into template_
+		$fieldTemplateParts = explode('###FIELD_', $altTemplate ?: $this->fieldTemplate);
+		$out = current($fieldTemplateParts);
+		foreach ($fieldTemplateParts as $part) {
+			list($key, $val) = explode('###', $part, 2);
+			$out .= $inArr[$key];
+			$out .= $val;
 		}
-		return $fields;
+		return $out;
 	}
 
 	/**
-	 * Returns TSconfig for table/row
-	 * Multiple requests to this function will return cached content so there is no performance loss in calling
-	 * this many times since the information is looked up only once.
+	 * Wraps all the table rows into a single table.
+	 * Used externally from scripts like alt_doc.php and db_layout.php (which uses TCEforms...)
 	 *
+	 * @param string $c Code to output between table-parts; table rows
+	 * @param array $rec The record
 	 * @param string $table The table name
-	 * @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
-	 * @param string $field Optionally you can specify the field name as well. In that case the TSconfig for the field is returned.
-	 * @return mixed The TSconfig values (probably in an array)
-	 * @see BackendUtility::getTCEFORM_TSconfig()
+	 * @return string
 	 */
-	public function setTSconfig($table, $row, $field = '') {
-		$mainKey = $table . ':' . $row['uid'];
-		if (!isset($this->cachedTSconfig[$mainKey])) {
-			$this->cachedTSconfig[$mainKey] = BackendUtility::getTCEFORM_TSconfig($table, $row);
-		}
-		if ($field) {
-			return $this->cachedTSconfig[$mainKey][$field];
-		} else {
-			return $this->cachedTSconfig[$mainKey];
-		}
+	public function wrapTotal($c, $rec, $table) {
+		$parts = $this->replaceTableWrap(explode('|', $this->totalWrap, 2), $rec, $table);
+		return $parts[0] . $c . $parts[1] . implode('', $this->hiddenFieldAccum);
 	}
 
 	/**
-	 * Overrides the TCA field configuration by TSconfig settings.
-	 *
-	 * Example TSconfig: TCEform.<table>.<field>.config.appearance.useSortable = 1
-	 * This overrides the setting in $GLOBALS['TCA'][<table>]['columns'][<field>]['config']['appearance']['useSortable'].
+	 * Generates a token and returns an input field with it
 	 *
-	 * @param array $fieldConfig $GLOBALS['TCA'] field configuration
-	 * @param array $TSconfig TSconfig
-	 * @return array Changed TCA field configuration
+	 * @param string $formName Context of the token
+	 * @param string $tokenName The name of the token GET/POST variable
+	 * @return string A complete input field
 	 */
-	public function overrideFieldConf($fieldConfig, $TSconfig) {
-		if (is_array($TSconfig)) {
-			$TSconfig = GeneralUtility::removeDotsFromTS($TSconfig);
-			$type = $fieldConfig['type'];
-			if (is_array($TSconfig['config']) && is_array($this->allowOverrideMatrix[$type])) {
-				// Check if the keys in TSconfig['config'] are allowed to override TCA field config:
-				foreach ($TSconfig['config'] as $key => $_) {
-					if (!in_array($key, $this->allowOverrideMatrix[$type], TRUE)) {
-						unset($TSconfig['config'][$key]);
-					}
-				}
-				// Override $GLOBALS['TCA'] field config by remaining TSconfig['config']:
-				if (count($TSconfig['config'])) {
-					ArrayUtility::mergeRecursiveWithOverrule($fieldConfig, $TSconfig['config']);
-				}
-			}
-		}
-		return $fieldConfig;
+	static public function getHiddenTokenField($formName = 'securityToken', $tokenName = 'formToken') {
+		$formprotection = FormProtectionFactory::get();
+		return '<input type="hidden" name="' . $tokenName . '" value="' . $formprotection->generateToken($formName) . '" />';
 	}
 
 	/**
-	 * Returns the "special" configuration (from the "types" "showitem" list) for a fieldname based on input table/record
-	 * (Not used anywhere...?)
+	 * This replaces markers in the total wrap
 	 *
+	 * @param array $arr An array of template parts containing some markers.
+	 * @param array $rec The record
 	 * @param string $table The table name
-	 * @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
-	 * @param string $field Specify the field name.
-	 * @return array|NULL
-	 * @see getSpecConfFromString(), BackendUtility::getTCAtypes()
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @return string
 	 */
-	public function getSpecConfForField($table, $row, $field) {
-		GeneralUtility::logDeprecatedFunction();
-		// Finds the current "types" configuration for the table/row:
-		$types_fieldConfig = BackendUtility::getTCAtypes($table, $row);
-		// If this is an array, then traverse it:
-		if (is_array($types_fieldConfig)) {
-			foreach ($types_fieldConfig as $vconf) {
-				// If the input field name matches one found in the 'types' list, then return the 'special' configuration.
-				if ($vconf['field'] == $field) {
-					return $vconf['spec'];
+	public function replaceTableWrap($arr, $rec, $table) {
+		$icon = IconUtility::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec)));
+		// Make "new"-label
+		$languageService = $this->getLanguageService();
+		if (strstr($rec['uid'], 'NEW')) {
+			$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 = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
+			if ($table === 'pages') {
+				$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewPage', TRUE);
+				$pageTitle = sprintf($label, $tableTitle);
+			} else {
+				$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecord', TRUE);
+				if ($rec['pid'] == 0) {
+					$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecordRootLevel', TRUE);
+				}
+				$pageTitle = sprintf($label, $tableTitle, $pageTitle);
+			}
+		} else {
+			$newLabel = ' <span class="typo3-TCEforms-recUid">[' . $rec['uid'] . ']</span>';
+			$rLabel = BackendUtility::getRecordTitle($table, $rec, TRUE, FALSE);
+			$prec = BackendUtility::getRecordWSOL('pages', $rec['pid'], 'uid,title');
+			// Fetch translated title of the table
+			$tableTitle = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
+			if ($table === 'pages') {
+				$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 = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecord', TRUE);
+				$pageTitle = BackendUtility::getRecordTitle('pages', $prec, TRUE, FALSE);
+				if ($rLabel === BackendUtility::getNoRecordTitle(TRUE)) {
+					$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordNoTitle', TRUE);
+				}
+				if ($rec['pid'] == 0) {
+					$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.
+					$pageTitle = sprintf($label, $tableTitle, $rLabel, $pageTitle);
+				} else {
+					// Leave out the record title since it is not set.
+					$pageTitle = sprintf($label, $tableTitle, $pageTitle);
 				}
 			}
+			$icon = $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($icon, $table, $rec['uid'], 1, '', '+copy,info,edit,view');
 		}
-		return NULL;
+		foreach ($arr as $k => $v) {
+			// Make substitutions:
+			$arr[$k] = str_replace(
+				array(
+					'###PAGE_TITLE###',
+					'###ID_NEW_INDICATOR###',
+					'###RECORD_LABEL###',
+					'###TABLE_TITLE###',
+					'###RECORD_ICON###'
+				),
+				array(
+					$pageTitle,
+					$newLabel,
+					$rLabel,
+					htmlspecialchars($languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
+					$icon
+				),
+				$arr[$k]
+			);
+		}
+		return $arr;
 	}
 
 	/**
-	 * Returns the "special" configuration of an "extra" string (non-parsed)
+	 * Creates HTML output for a palette
 	 *
-	 * @param string $extraString The "Part 4" of the fields configuration in "types" "showitem" lists.
-	 * @param string $defaultExtras The ['defaultExtras'] value from field configuration
-	 * @return array An array with the special options in.
-	 * @see getSpecConfForField(), BackendUtility::getSpecConfParts()
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param array $palArr The palette array to print
+	 * @return string HTML output
 	 */
-	public function getSpecConfFromString($extraString, $defaultExtras) {
-		GeneralUtility::logDeprecatedFunction();
-		return BackendUtility::getSpecConfParts($extraString, $defaultExtras);
-	}
+	public function printPalette($palArr) {
 
-	/**
-	 * Loads the elements of a palette (collection of secondary options) in an array.
-	 *
-	 * @param string $table The table name
-	 * @param array $row The row array
-	 * @param string $palette The palette number/pointer
-	 * @param string $itemList Optional alternative list of fields for the palette
-	 * @return array The palette elements
-	 */
-	public function loadPaletteElements($table, $row, $palette, $itemList = '') {
-		$parts = array();
-		// Getting excludeElements, if any.
-		if (!is_array($this->excludeElements)) {
-			$this->excludeElements = $this->getExcludeElements($table, $row, $this->getRTypeNum($table, $row));
-		}
-		// Load the palette TCEform elements
-		if ($GLOBALS['TCA'][$table] && (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) || $itemList)) {
-			$itemList = $itemList ? $itemList : $GLOBALS['TCA'][$table]['palettes'][$palette]['showitem'];
-			if ($itemList) {
-				$fields = GeneralUtility::trimExplode(',', $itemList, TRUE);
-				foreach ($fields as $info) {
-					$fieldParts = GeneralUtility::trimExplode(';', $info);
-					$theField = $fieldParts[0];
-					if ($theField === '--linebreak--') {
-						$parts[]['NAME'] = '--linebreak--';
-					} elseif (!in_array($theField, $this->excludeElements) && $GLOBALS['TCA'][$table]['columns'][$theField]) {
-						$this->palFieldArr[$palette][] = $theField;
-						$elem = $this->getSingleField($table, $theField, $row, $fieldParts[1], 1, '', $fieldParts[2]);
-						if (is_array($elem)) {
-							$parts[] = $elem;
-						}
-					}
+		// GROUP FIELDS
+		$groupedFields = array();
+		$row = 0;
+		$lastLineWasLinebreak = TRUE;
+		foreach ($palArr as $field){
+			if ($field['NAME'] === '--linebreak--') {
+				if (!$lastLineWasLinebreak) {
+					$row++;
+					$groupedFields[$row][] = $field;
+					$row++;
+					$lastLineWasLinebreak = TRUE;
 				}
+			} else {
+				$lastLineWasLinebreak = FALSE;
+				$groupedFields[$row][] = $field;
 			}
 		}
-		return $parts;
-	}
 
-	/************************************************************
-	 *
-	 * Display of localized content etc.
-	 *
-	 ************************************************************/
-	/**
-	 * Will register data from original language records if the current record is a translation of another.
-	 * The original data is shown with the edited record in the form.
-	 * The information also includes possibly diff-views of what changed in the original record.
-	 * Function called from outside (see alt_doc.php + quick edit) before rendering a form for a record
-	 *
-	 * @param string $table Table name of the record being edited
-	 * @param array $rec Record array of the record being edited
-	 * @return void
+		$out = '';
+		// PROCESS FIELDS
+		foreach ($groupedFields as $fields) {
+
+			$numberOfItems = count($fields);
+			$cols = $numberOfItems;
+			$colWidth = (int)floor(12 / $cols);
+
+			// COLS
+			$colClass = "col-md-12";
+			$colClear = array();
+			if ($colWidth == 6) {
+				$colClass = "col-sm-6";
+				$colClear = array(
+					2 => 'visible-sm-block visible-md-block visible-lg-block',
+				);
+			} elseif ($colWidth === 4) {
+				$colClass = "col-sm-4";
+				$colClear = array(
+					3 => 'visible-sm-block visible-md-block visible-lg-block',
+				);
+			} elseif ($colWidth === 3) {
+				$colClass = "col-sm-6 col-md-3";
+				$colClear = array(
+					2 => 'visible-sm-block',
+					4 => 'visible-md-block visible-lg-block',
+				);
+			} elseif ($colWidth <= 2) {
+				$colClass = "checkbox-column col-sm-6 col-md-3 col-lg-2";
+				$colClear = array(
+					2 => 'visible-sm-block',
+					4 => 'visible-md-block',
+					6 => 'visible-lg-block'
+				);
+			}
+
+			// RENDER FIELDS
+			for ($counter = 0; $counter < $numberOfItems; $counter++) {
+				$content = $fields[$counter];
+				if ($content['NAME'] === '--linebreak--') {
+					if ($counter !== $numberOfItems) {
+						$out .= '<div class="clearfix"></div>';
+					}
+				} else {
+
+					// ITEM
+					$out .= '
+						<!-- printPalette -->
+						<div class="form-group t3js-formengine-palette-field ' . $colClass . '">
+							<label class="t3js-formengine-label">
+								' . $content['NAME'] . '
+								<img name="req_' . $content['TABLE'] . '_' . $content['ID'] . '_' . $content['FIELD'] . '" src="clear.gif" class="t3js-formengine-field-required" alt="" />
+							</label>
+							' . $content['ITEM_NULLVALUE'] . '
+							<div class="t3js-formengine-field-item ' . $content['ITEM_DISABLED'] . '">
+								<div class="t3-form-field-disable"></div>
+								' . $content['ITEM'] . '
+							</div>
+						</div>';
+
+					// BREAKPOINTS
+					if ($counter + 1 < $numberOfItems && !empty($colClear)) {
+						foreach ($colClear as $rowBreakAfter => $clearClass) {
+							if (($counter + 1) % $rowBreakAfter === 0) {
+								$out .= '<div class="clearfix '. $clearClass . '"></div>';
+							}
+						}
+					}
+				}
+			}
+		}
+		return $out;
+	}
+
+	/********************************************
+	 *
+	 * JavaScript related functions
+	 *
+	 ********************************************/
+	/**
+	 * JavaScript code added BEFORE the form is drawn:
+	 *
+	 * @return string A <script></script> section with JavaScript.
 	 */
-	public function registerDefaultLanguageData($table, $rec) {
-		// Add default language:
-		if (
-			$GLOBALS['TCA'][$table]['ctrl']['languageField'] && $rec[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0
-			&& $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
-			&& (int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0
-		) {
-			$lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']
-				? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']
-				: $table;
-			// Get data formatted:
-			$this->defaultLanguageData[$table . ':' . $rec['uid']] = BackendUtility::getRecordWSOL(
-				$lookUpTable,
-				(int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]
+	public function JStop() {
+		$out = '';
+		// Additional top HTML:
+		if (count($this->additionalCode_pre)) {
+			$out .= implode('
+
+				<!-- NEXT: -->
+			', $this->additionalCode_pre);
+		}
+		return $out;
+	}
+
+	/**
+	 * JavaScript code used for input-field evaluation.
+	 *
+	 * Example use:
+	 *
+	 * $msg .= 'Distribution time (hh:mm dd-mm-yy):<br /><input type="text" name="send_mail_datetime_hr"'
+	 *         . ' onchange="typo3form.fieldGet(\'send_mail_datetime\', \'datetime\', \'\', 0,0);"'
+	 *         . $this->getTBE()->formWidth(20) . ' /><input type="hidden" value="' . $GLOBALS['EXEC_TIME']
+	 *         . '" name="send_mail_datetime" /><br />';
+	 * $this->extJSCODE .= 'typo3form.fieldSet("send_mail_datetime", "datetime", "", 0,0);';
+	 *
+	 * ... and then include the result of this function after the form
+	 *
+	 * @param string $formname The identification of the form on the page.
+	 * @param bool $update Just extend/update existing settings, e.g. for AJAX call
+	 * @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 = '';
+		// Required:
+		foreach ($this->requiredFields as $itemImgName => $itemName) {
+			$match = array();
+			if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
+				$record = $match[1];
+				$field = $match[2];
+				$elements[$record][$field]['required'] = 1;
+				$elements[$record][$field]['requiredImg'] = $itemImgName;
+				if (isset($this->requiredAdditional[$itemName]) && is_array($this->requiredAdditional[$itemName])) {
+					$elements[$record][$field]['additional'] = $this->requiredAdditional[$itemName];
+				}
+			}
+		}
+		// Range:
+		foreach ($this->requiredElements as $itemName => $range) {
+			if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
+				$record = $match[1];
+				$field = $match[2];
+				$elements[$record][$field]['range'] = array($range[0], $range[1]);
+				$elements[$record][$field]['rangeImg'] = $range['imgName'];
+			}
+		}
+		$this->TBE_EDITOR_fieldChanged_func = 'TBE_EDITOR.fieldChanged_fName(fName,formObj[fName+"_list"]);';
+		if (!$update) {
+			if ($this->loadMD5_JS) {
+				$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
+			}
+			$pageRenderer = $this->getPageRenderer();
+			// load the main module for FormEngine with all important JS functions
+			$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FormEngine');
+			$pageRenderer->loadPrototype();
+			$pageRenderer->loadJquery();
+			$pageRenderer->loadExtJS();
+			$beUserAuth = $this->getBackendUserAuthentication();
+			// Make textareas resizable and flexible ("autogrow" in height)
+			$textareaSettings = array(
+				'autosize'  => (bool)$beUserAuth->uc['resizeTextareas_Flexible']
 			);
-			// Get data for diff:
-			if ($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
-				$this->defaultLanguageData_diff[$table . ':' . $rec['uid']] = unserialize($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']]);
+			$pageRenderer->addInlineSettingArray('Textarea', $textareaSettings);
+
+			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js');
+			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
+			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/ValueSlider.js');
+			// Needed for FormEngine manipulation (date picker)
+			$dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY'));
+			$pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
+
+			// support placeholders for IE9 and lower
+			$clientInfo = GeneralUtility::clientInfo();
+			if ($clientInfo['BROWSER'] == 'msie' && $clientInfo['VERSION'] <= 9) {
+				$this->loadJavascriptLib('contrib/placeholdersjs/placeholders.jquery.min.js');
 			}
-			// If there are additional preview languages, load information for them also:
-			$prLang = $this->getAdditionalPreviewLanguages();
-			foreach ($prLang as $prL) {
-				/** @var $t8Tools \TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider */
-				$t8Tools = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider::class);
-				$tInfo = $t8Tools->translationInfo($lookUpTable, (int)$rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], $prL['uid']);
-				if (is_array($tInfo['translations']) && is_array($tInfo['translations'][$prL['uid']])) {
-					$this->additionalPreviewLanguageData[$table . ':' . $rec['uid']][$prL['uid']] = BackendUtility::getRecordWSOL($table, (int)$tInfo['translations'][$prL['uid']]['uid']);
+
+			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tceforms.js');
+			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
+
+			// If IRRE fields were processed, add the JavaScript functions:
+			if ($this->inline->inlineCount) {
+				$pageRenderer->loadScriptaculous();
+				// We want to load jQuery-ui inside our js. Enable this using requirejs.
+				$pageRenderer->loadRequireJs();
+				$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js');
+				$out .= '
+				inline.setPrependFormFieldNames("' . $this->inline->prependNaming . '");
+				inline.setNoTitleString("' . addslashes(BackendUtility::getNoRecordTitle(TRUE)) . '");
+				';
+			}
+			$out .= '
+			TBE_EDITOR.images.req.src = "' . IconUtility::skinImg('', 'gfx/required_h.gif', '', 1) . '";
+			TBE_EDITOR.images.sel.src = "' . IconUtility::skinImg('', 'gfx/content_selected.gif', '', 1) . '";
+			TBE_EDITOR.images.clear.src = "clear.gif";
+
+			TBE_EDITOR.formname = "' . $formname . '";
+			TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
+			TBE_EDITOR.backPath = "";
+			TBE_EDITOR.prependFormFieldNames = "' . $this->prependFormFieldNames . '";
+			TBE_EDITOR.prependFormFieldNamesUENC = "' . rawurlencode($this->prependFormFieldNames) . '";
+			TBE_EDITOR.prependFormFieldNamesCnt = ' . substr_count($this->prependFormFieldNames, '[') . ';
+			TBE_EDITOR.isPalettedoc = null;
+			TBE_EDITOR.doSaveFieldName = "' . ($this->doSaveFieldName ? addslashes($this->doSaveFieldName) : '') . '";
+			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.maxItemsAllowed = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.maxItemsAllowed')) . ';
+			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'] . '";
+
+			TBE_EDITOR.customEvalFunctions = {};
+
+			';
+		}
+		// Add JS required for inline fields
+		if (count($this->inline->inlineData)) {
+			$out .= '
+			inline.addToDataArray(' . json_encode($this->inline->inlineData) . ');
+			';
+		}
+		// Registered nested elements for tabs or inline levels:
+		if (count($this->requiredNested)) {
+			$out .= '
+			TBE_EDITOR.addNested(' . json_encode($this->requiredNested) . ');
+			';
+		}
+		// Elements which are required or have a range definition:
+		if (count($elements)) {
+			$out .= '
+			TBE_EDITOR.addElements(' . json_encode($elements) . ');
+			TBE_EDITOR.initRequired();
+			';
+		}
+		// $this->additionalJS_submit:
+		if ($this->additionalJS_submit) {
+			$additionalJS_submit = implode('', $this->additionalJS_submit);
+			$additionalJS_submit = str_replace(array(CR, LF), '', $additionalJS_submit);
+			$out .= '
+			TBE_EDITOR.addActionChecks("submit", "' . addslashes($additionalJS_submit) . '");
+			';
+		}
+		$out .= LF . implode(LF, $this->additionalJS_post) . LF . $this->extJSCODE;
+		// Regular direct output:
+		if (!$update) {
+			$spacer = LF . TAB;
+			$out = $spacer . implode($spacer, $jsFile) . GeneralUtility::wrapJS($out);
+		}
+		return $out;
+	}
+
+	/**
+	 * Prints necessary JavaScript for TCEforms (after the form HTML).
+	 * currently this is used to transform page-specific options in the TYPO3.Settings array for JS
+	 * so the JS module can access these values
+	 *
+	 * @return string
+	 */
+	public function printNeededJSFunctions() {
+		/** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+		$pageRenderer = $this->getControllerDocumentTemplate()->getPageRenderer();
+
+		// set variables to be accessible for JS
+		$pageRenderer->addInlineSetting('FormEngine', 'formName', 'editform');
+		$pageRenderer->addInlineSetting('FormEngine', 'backPath', '');
+
+		// Integrate JS functions for the element browser if such fields or IRRE fields were processed
+		$pageRenderer->addInlineSetting('FormEngine', 'legacyFieldChangedCb', 'function() { ' . $this->TBE_EDITOR_fieldChanged_func . ' };');
+
+		return $this->JSbottom('editform');
+	}
+
+	/**
+	 * Returns necessary JavaScript for the top
+	 *
+	 * @return string
+	 */
+	public function printNeededJSFunctions_top() {
+		return $this->JStop('editform');
+	}
+
+	/**
+	 * Includes a javascript library that exists in the core /typo3/ directory. The
+	 * backpath is automatically applied.
+	 * This method acts as wrapper for $GLOBALS['SOBE']->doc->loadJavascriptLib($lib).
+	 *
+	 * @param string $lib Library name. Call it with the full path like "contrib/prototype/prototype.js" to load it
+	 * @return void
+	 */
+	public function loadJavascriptLib($lib) {
+		$this->getControllerDocumentTemplate()->loadJavascriptLib($lib);
+	}
+
+	/**
+	 * Wrapper for access to the current page renderer object
+	 *
+	 * @return \TYPO3\CMS\Core\Page\PageRenderer
+	 */
+	protected function getPageRenderer() {
+		return $this->getControllerDocumentTemplate()->getPageRenderer();
+	}
+
+	/********************************************
+	 *
+	 * Various helper functions
+	 *
+	 ********************************************/
+
+	/**
+	 * Returns TRUE if the given $row is new (i.e. has not been saved to the database)
+	 *
+	 * @param string $table
+	 * @param array $row
+	 * @return bool
+	 */
+	protected function isNewRecord($table, $row) {
+		return !MathUtility::canBeInterpretedAsInteger($row['uid']) && GeneralUtility::isFirstPartOfStr($row['uid'], 'NEW');
+	}
+
+	/**
+	 * Return record path (visually formatted, using BackendUtility::getRecordPath() )
+	 *
+	 * @param string $table Table name
+	 * @param array $rec Record array
+	 * @return string The record path.
+	 * @see BackendUtility::getRecordPath()
+	 */
+	public function getRecordPath($table, $rec) {
+		BackendUtility::fixVersioningPid($table, $rec);
+		list($tscPID, $thePidValue) = BackendUtility::getTSCpidCached($table, $rec['uid'], $rec['pid']);
+		if ($thePidValue >= 0) {
+			return BackendUtility::getRecordPath($tscPID, $this->readPerms(), 15);
+		}
+		return '';
+	}
+
+	/**
+	 * Returns the select-page read-access SQL clause.
+	 * Returns cached string, so you can call this function as much as you like without performance loss.
+	 *
+	 * @return string
+	 */
+	public function readPerms() {
+		if (!$this->perms_clause_set) {
+			$this->perms_clause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
+			$this->perms_clause_set = TRUE;
+		}
+		return $this->perms_clause;
+	}
+
+	/**
+	 * Returns TRUE, if the palette, $palette, is collapsed (not shown, but found in top-frame) for the table.
+	 *
+	 * @param string $table The table name
+	 * @param int $palette The palette pointer/number
+	 * @return bool
+	 */
+	public function isPalettesCollapsed($table, $palette) {
+		if (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) && $GLOBALS['TCA'][$table]['palettes'][$palette]['isHiddenPalette']) {
+			return TRUE;
+		}
+		if ($GLOBALS['TCA'][$table]['ctrl']['canNotCollapse']) {
+			return FALSE;
+		}
+		if (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) && $GLOBALS['TCA'][$table]['palettes'][$palette]['canNotCollapse']) {
+			return FALSE;
+		}
+		return $this->palettesCollapsed;
+	}
+
+	/**
+	 * Returns TRUE if descriptions should be loaded always
+	 *
+	 * @param string $table Table for which to check
+	 * @return bool
+	 */
+	public function doLoadTableDescr($table) {
+		return $GLOBALS['TCA'][$table]['interface']['always_description'];
+	}
+
+	/**
+	 * Renders an icon to indicate the way the translation and the original is merged (if this is relevant).
+	 *
+	 * If a field is defined as 'mergeIfNotBlank' this is useful information for an editor. He/she can leave the field blank and
+	 * the original value will be used. Without this hint editors are likely to copy the contents even if it is not necessary.
+	 *
+	 * @param string $l10nMode Localization mode from TCA
+	 * @return string
+	 */
+	protected function getMergeBehaviourIcon($l10nMode) {
+		$icon = '';
+		if ($l10nMode === 'mergeIfNotBlank') {
+			$icon = IconUtility::getSpriteIcon('actions-edit-merge-localization', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:localizeMergeIfNotBlank')));
+		}
+		return $icon;
+	}
+
+	/**
+	 * Rendering preview output of a field value which is not shown as a form field but just outputted.
+	 *
+	 * @param string $value The value to output
+	 * @param array $config Configuration for field.
+	 * @param string $field Name of field.
+	 * @return string HTML formatted output
+	 */
+	public function previewFieldValue($value, $config, $field = '') {
+		if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
+			// Ignore uploadfolder if internal_type is file_reference
+			if ($config['config']['internal_type'] === 'file_reference') {
+				$config['config']['uploadfolder'] = '';
+			}
+			$show_thumbs = TRUE;
+			$table = 'tt_content';
+			// Making the array of file items:
+			$itemArray = GeneralUtility::trimExplode(',', $value, TRUE);
+			// Showing thumbnails:
+			$thumbsnail = '';
+			if ($show_thumbs) {
+				$imgs = array();
+				foreach ($itemArray as $imgRead) {
+					$imgP = explode('|', $imgRead);
+					$imgPath = rawurldecode($imgP[0]);
+					$rowCopy = array();
+					$rowCopy[$field] = $imgPath;
+					// Icon + clickmenu:
+					$absFilePath = GeneralUtility::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
+					$fileInformation = pathinfo($imgPath);
+					$fileIcon = IconUtility::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . GeneralUtility::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!'))));
+					$imgs[] =
+						'<span class="nobr">' .
+							BackendUtility::thumbCode(
+								$rowCopy,
+								$table,
+								$field,
+								'',
+								'thumbs.php',
+								$config['config']['uploadfolder'], 0, ' align="middle"'
+							) .
+							($absFilePath ? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($fileIcon, $absFilePath, 0, 1, '', '+copy,info,edit,view') : $fileIcon) . $imgPath .
+						'</span>';
 				}
+				$thumbsnail = implode('<br />', $imgs);
 			}
+			return $thumbsnail;
+		} else {
+			return nl2br(htmlspecialchars($value));
 		}
 	}
 
 	/**
-	 * Creates language-overlay for a field value
-	 * This means the requested field value will be overridden with the data from the default language.
-	 * Can be used to render read only fields for example.
+	 * Generates and return information about which languages the current user should see in preview, configured by options.additionalPreviewLanguages
 	 *
-	 * @param string $table Table name of the record being edited
-	 * @param array $row Record array of the record being edited in current language
-	 * @param string $field Field name represented by $item
-	 * @param array $fieldConf Content of $PA['fieldConf']
-	 * @return string Unprocessed field value merged with default language data if needed
+	 * @return array Array of additional languages to preview
 	 */
-	public function getLanguageOverlayRawValue($table, $row, $field, $fieldConf) {
-		$value = $row[$field];
-		if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
-			if (
-				$fieldConf['l10n_mode'] == 'exclude'
-				|| $fieldConf['l10n_mode'] == 'mergeIfNotBlank' && trim($this->defaultLanguageData[$table . ':' . $row['uid']][$field]) !== ''
-			) {
-				$value = $this->defaultLanguageData[$table . ':' . $row['uid']][$field];
+	public function getAdditionalPreviewLanguages() {
+		if (!isset($this->cachedAdditionalPreviewLanguages)) {
+			$this->cachedAdditionalPreviewLanguages = array();
+			if ($this->getBackendUserAuthentication()->getTSConfigVal('options.additionalPreviewLanguages')) {
+				$uids = GeneralUtility::intExplode(',', $this->getBackendUserAuthentication()->getTSConfigVal('options.additionalPreviewLanguages'));
+				foreach ($uids as $uid) {
+					if ($sys_language_rec = BackendUtility::getRecord('sys_language', $uid)) {
+						$this->cachedAdditionalPreviewLanguages[$uid] = array('uid' => $uid);
+						if (!empty($sys_language_rec['language_isocode'])) {
+							$this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $sys_language_rec['language_isocode'];
+						} elseif ($sys_language_rec['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) {
+							GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
+							$staticLangRow = BackendUtility::getRecord('static_languages', $sys_language_rec['static_lang_isocode'], 'lg_iso_2');
+							if ($staticLangRow['lg_iso_2']) {
+								$this->cachedAdditionalPreviewLanguages[$uid]['uid'] = $uid;
+								$this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $staticLangRow['lg_iso_2'];
+							}
+						}
+					}
+				}
 			}
 		}
-		return $value;
+		return $this->cachedAdditionalPreviewLanguages;
 	}
 
 	/**
-	 * Renders the display of default language record content around current field.
-	 * Will render content if any is found in the internal array, $this->defaultLanguageData,
-	 * depending on registerDefaultLanguageData() being called prior to this.
+	 * Push a new element to the dynNestedStack. Thus, every object know, if it's
+	 * nested in a tab or IRRE level and in which order this was processed.
 	 *
-	 * @param string $table Table name of the record being edited
-	 * @param string $field Field name represented by $item
-	 * @param array $row Record array of the record being edited
-	 * @param string $item 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()
+	 * @param string $type Type of the level, e.g. "tab" or "inline
+	 * @param string $ident Identifier of the level
+	 * @return void
 	 */
-	public function renderDefaultLanguageContent($table, $field, $row, $item) {
-		if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
-			$defaultLanguageValue = BackendUtility::getProcessedValue($table, $field, $this->defaultLanguageData[$table . ':' . $row['uid']][$field], 0, 1, FALSE, $this->defaultLanguageData[$table . ':' . $row['uid']]['uid']);
-			$fieldConfig = $GLOBALS['TCA'][$table]['columns'][$field];
-			// Don't show content if it's for IRRE child records:
-			if ($fieldConfig['config']['type'] != 'inline') {
-				if ($defaultLanguageValue !== '') {
-					$item .= '<div class="t3-form-original-language">' . $this->getLanguageIcon($table, $row, 0)
-						. $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
-						. $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
-				}
-				$previewLanguages = $this->getAdditionalPreviewLanguages();
-				foreach ($previewLanguages as $previewLanguage) {
-					$defaultLanguageValue = BackendUtility::getProcessedValue($table, $field, $this->additionalPreviewLanguageData[$table . ':' . $row['uid']][$previewLanguage['uid']][$field], 0, 1);
-					if ($defaultLanguageValue !== '') {
-						$item .= '<div class="t3-form-original-language">'
-							. $this->getLanguageIcon($table, $row, ('v' . $previewLanguage['ISOcode']))
-							. $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
-							. $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
-					}
-				}
+	public function pushToDynNestedStack($type, $ident) {
+		$this->dynNestedStack[] = array($type, $ident);
+	}
+
+	/**
+	 * Remove an element from the dynNestedStack. If $type and $ident
+	 * are set, the last element will only be removed, if it matches
+	 * what is expected to be removed.
+	 *
+	 * @param string $type Type of the level, e.g. "tab" or "inline
+	 * @param string $ident Identifier of the level
+	 * @return void
+	 */
+	public function popFromDynNestedStack($type = NULL, $ident = NULL) {
+		if ($type != NULL && $ident != NULL) {
+			$last = end($this->dynNestedStack);
+			if ($type == $last[0] && $ident == $last[1]) {
+				array_pop($this->dynNestedStack);
 			}
+		} else {
+			array_pop($this->dynNestedStack);
 		}
-		return $item;
 	}
 
 	/**
-	 * Renders the diff-view of default language record content compared with what the record was originally translated from.
-	 * Will render content if any is found in the internal array, $this->defaultLanguageData,
-	 * depending on registerDefaultLanguageData() being called prior to this.
+	 * Get the dynNestedStack as associative array.
+	 * The result is e.g. ['tab','DTM-ABCD-1'], ['inline','data[13][table][uid][field]'], ['tab','DTM-DEFG-2'], ...
 	 *
-	 * @param string $table Table name of the record being edited
-	 * @param string $field Field name represented by $item
-	 * @param array $row Record array of the record being edited
-	 * @param string  $item 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()
+	 * @param bool $json Return a JSON string instead of an array - default: FALSE
+	 * @param bool $skipFirst Skip the first element in the dynNestedStack - default: FALSE
+	 * @return mixed Returns an associative array by default. If $json is TRUE, it will be returned as JSON string.
 	 */
-	public function renderDefaultLanguageDiff($table, $field, $row, $item) {
-		if (is_array($this->defaultLanguageData_diff[$table . ':' . $row['uid']])) {
-			// Initialize:
-			$dLVal = array(
-				'old' => $this->defaultLanguageData_diff[$table . ':' . $row['uid']],
-				'new' => $this->defaultLanguageData[$table . ':' . $row['uid']]
+	public function getDynNestedStack($json = FALSE, $skipFirst = FALSE) {
+		$result = $this->dynNestedStack;
+		if ($skipFirst) {
+			array_shift($result);
+		}
+		return $json ? json_encode($result) : $result;
+	}
+
+	/**
+	 * Takes care of registering properties in requiredFields and requiredElements.
+	 * The current hierarchy of IRRE and/or Tabs is stored. Thus, it is possible to determine,
+	 * which required field/element was filled incorrectly and show it, even if the Tab or IRRE
+	 * level is hidden.
+	 *
+	 * @param string $type Type of requirement ('field' or 'range')
+	 * @param string $name The name of the form field
+	 * @param mixed $value For type 'field' string, for type 'range' array
+	 * @return void
+	 */
+	public function registerRequiredProperty($type, $name, $value) {
+		if ($type == 'field' && is_string($value)) {
+			$this->requiredFields[$name] = $value;
+			// requiredFields have name/value swapped! For backward compatibility we keep this:
+			$itemName = $value;
+		} elseif ($type == 'range' && is_array($value)) {
+			$this->requiredElements[$name] = $value;
+			$itemName = $name;
+		} else {
+			$itemName = '';
+		}
+		// Set the situation of nesting for the current field:
+		$this->registerNestedElement($itemName);
+	}
+
+	/**
+	 * Sets the current situation of nested tabs and inline levels for a given element.
+	 *
+	 * @param string $itemName The element the nesting should be stored for
+	 * @param bool $setLevel Set the reverse level lookup - default: TRUE
+	 * @return void
+	 */
+	protected function registerNestedElement($itemName, $setLevel = TRUE) {
+		$dynNestedStack = $this->getDynNestedStack();
+		if (count($dynNestedStack) && preg_match('/^(.+\\])\\[(\\w+)\\]$/', $itemName, $match)) {
+			array_shift($match);
+			$this->requiredNested[$itemName] = array(
+				'parts' => $match,
+				'level' => $dynNestedStack
 			);
-			// There must be diff-data:
-			if (isset($dLVal['old'][$field])) {
-				if ((string)$dLVal['old'][$field] !== (string)$dLVal['new'][$field]) {
-					// Create diff-result:
-					$t3lib_diff_Obj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\DiffUtility::class);
-					$diffres = $t3lib_diff_Obj->makeDiffDisplay(
-						BackendUtility::getProcessedValue($table, $field, $dLVal['old'][$field], 0, 1),
-						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-diffcontent">' . $diffres . '</div>
-					</div>';
-				}
-			}
 		}
-		return $item;
 	}
 
 	/**
-	 * 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.
-	 * @see getSingleField(), registerDefaultLanguageData()
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * Return the placeholder attribute for an input field.
+	 *
+	 * @param string $table
+	 * @param string $field
+	 * @param array $config
+	 * @param array $row
+	 * @return string
+	 */
+	public function getPlaceholderAttribute($table, $field, array $config, array $row) {
+		$value = $this->getPlaceholderValue($table, $field, $config, $row);
+
+		// Cleanup the string and support 'LLL:'
+		$value = htmlspecialchars(trim($this->getLanguageService()->sL($value)));
+		return empty($value) ? '' : ' placeholder="' . $value . '" ';
+	}
+
+	/**
+	 * Determine and get the value for the placeholder for an input field.
+	 *
+	 * @param string $table
+	 * @param string $field
+	 * @param array $config
+	 * @param array $row
+	 * @return mixed
+	 */
+	protected function getPlaceholderValue($table, $field, array $config, array $row) {
+		$value = trim($config['placeholder']);
+		if (!$value) {
+			return '';
+		}
+		// Check if we have a reference to another field value from the current record
+		if (substr($value, 0, 6) === '__row|') {
+			/** @var FormDataTraverser $traverser */
+			$traverseFields = GeneralUtility::trimExplode('|', substr($value, 6));
+			$traverser = GeneralUtility::makeInstance(FormDataTraverser::class, $this);
+			$value = $traverser->getTraversedFieldValue($traverseFields, $table, $row);
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Insert additional style sheet link
+	 *
+	 * @param string $key Some key identifying the style sheet
+	 * @param string $href Uri to the style sheet file
+	 * @param string $title Value for the title attribute of the link element
+	 * @param string $relation Value for the rel attribute of the link element
+	 * @return void
+	 */
+	public function addStyleSheet($key, $href, $title = '', $relation = 'stylesheet') {
+		$this->getControllerDocumentTemplate()->addStyleSheet($key, $href, $title, $relation);
+	}
+
+	/**
+	 * @return BackendUserAuthentication
+	 */
+	protected function getBackendUserAuthentication() {
+		return $GLOBALS['BE_USER'];
+	}
+
+	/**
+	 * @return DocumentTemplate
 	 */
-	public function renderVDEFDiff($vArray, $vDEFkey) {
-		GeneralUtility::logDeprecatedFunction();
-		$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;
+	protected function getControllerDocumentTemplate() {
+		// $GLOBALS['SOBE'] might be any kind of PHP class (controller most of the times)
+		// These class do not inherit from any common class, but they all seem to have a "doc" member
+		return $GLOBALS['SOBE']->doc;
 	}
 
-	/************************************************************
-	 *
-	 * Form element helper functions
-	 *
-	 ************************************************************/
 	/**
-	 * Prints the selector box form-field for the db/file/select elements (multiple)
-	 *
-	 * @param string $fName Form element name
-	 * @param string $mode Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type)
-	 * @param string $allowed Commalist of "allowed
-	 * @param array $itemArray The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs.
-	 * @param string $selector Alternative selector box.
-	 * @param array $params An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails
-	 * @param string $onFocus On focus attribute string
-	 * @param string $table (optional) Table name processing for
-	 * @param string $field (optional) Field of table name processing for
-	 * @param string $uid (optional) uid of table record processing for
-	 * @param array $config (optional) The TCA field config
-	 * @return string The form fields for the selection.
-	 * @throws \UnexpectedValueException
+	 * @return DatabaseConnection
 	 */
-	public function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $table = '', $field = '', $uid = '', $config = array()) {
-		$languageService = $this->getLanguageService();
-		$disabled = '';
-		if ($this->getRenderReadonly() || $params['readOnly']) {
-			$disabled = ' disabled="disabled"';
-		}
-		// Sets a flag which means some JavaScript is included on the page to support this element.
-		$this->printNeededJS['dbFileIcons'] = 1;
-		// INIT
-		$uidList = array();
-		$opt = array();
-		$itemArrayC = 0;
-		// Creating <option> elements:
-		if (is_array($itemArray)) {
-			$itemArrayC = count($itemArray);
-			switch ($mode) {
-				case 'db':
-					foreach ($itemArray as $pp) {
-						$pRec = BackendUtility::getRecordWSOL($pp['table'], $pp['id']);
-						if (is_array($pRec)) {
-							$pTitle = BackendUtility::getRecordTitle($pp['table'], $pRec, FALSE, TRUE);
-							$pUid = $pp['table'] . '_' . $pp['id'];
-							$uidList[] = $pUid;
-							$title = htmlspecialchars($pTitle);
-							$opt[] = '<option value="' . htmlspecialchars($pUid) . '" title="' . $title . '">' . $title . '</option>';
-						}
-					}
-					break;
-				case 'file_reference':
-
-				case 'file':
-					foreach ($itemArray as $item) {
-						$itemParts = explode('|', $item);
-						$uidList[] = ($pUid = ($pTitle = $itemParts[0]));
-						$title = htmlspecialchars(rawurldecode($itemParts[1]));
-						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($itemParts[0])) . '" title="' . $title . '">' . $title . '</option>';
-					}
-					break;
-				case 'folder':
-					foreach ($itemArray as $pp) {
-						$pParts = explode('|', $pp);
-						$uidList[] = ($pUid = ($pTitle = $pParts[0]));
-						$title = htmlspecialchars(rawurldecode($pParts[0]));
-						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '" title="' . $title . '">' . $title . '</option>';
-					}
-					break;
-				default:
-					foreach ($itemArray as $pp) {
-						$pParts = explode('|', $pp, 2);
-						$uidList[] = ($pUid = $pParts[0]);
-						$pTitle = $pParts[1];
-						$title = htmlspecialchars(rawurldecode($pTitle));
-						$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '" title="' . $title . '">' . $title . '</option>';
-					}
-			}
-		}
-		// Create selector box of the options
-		$sSize = $params['autoSizeMax']
-			? MathUtility::forceIntegerInRange($itemArrayC + 1, MathUtility::forceIntegerInRange($params['size'], 1), $params['autoSizeMax'])
-			: $params['size'];
-		if (!$selector) {
-			$isMultiple = $params['maxitems'] != 1 && $params['size'] != 1;
-			$selector = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE)) . '" '
-				. ($params['noList'] ? 'style="display: none"' : 'size="' . $sSize . '" class="form-control tceforms-multiselect"')
-				. ($isMultiple ? ' multiple="multiple"' : '')
-				. ' name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt)
-				. '</select>';
-		}
-		$icons = array(
-			'L' => array(),
-			'R' => array()
-		);
-		$rOnClickInline = '';
-		if (!$params['readOnly'] && !$params['noList']) {
-			if (!$params['noBrowser']) {
-				// Check against inline uniqueness
-				$inlineParent = $this->inline->getStructureLevel(-1);
-				$aOnClickInline = '';
-				if (is_array($inlineParent) && $inlineParent['uid']) {
-					if ($inlineParent['config']['foreign_table'] == $table && $inlineParent['config']['foreign_unique'] == $field) {
-						$objectPrefix = $this->inline->inlineNames['object'] . InlineElement::Structure_Separator . $table;
-						$aOnClickInline = $objectPrefix . '|inline.checkUniqueElement|inline.setUniqueElement';
-						$rOnClickInline = 'inline.revertUnique(\'' . $objectPrefix . '\',null,\'' . $uid . '\');';
-					}
-				}
-				if (is_array($config['appearance']) && isset($config['appearance']['elementBrowserType'])) {
-					$elementBrowserType = $config['appearance']['elementBrowserType'];
-				} else {
-					$elementBrowserType = $mode;
-				}
-				if (is_array($config['appearance']) && isset($config['appearance']['elementBrowserAllowed'])) {
-					$elementBrowserAllowed = $config['appearance']['elementBrowserAllowed'];
-				} else {
-					$elementBrowserAllowed = $allowed;
-				}
-				$aOnClick = 'setFormValueOpenBrowser(\'' . $elementBrowserType . '\',\''
-					. ($fName . '|||' . $elementBrowserAllowed . '|' . $aOnClickInline) . '\'); return false;';
-				$icons['R'][] = '
-					<a href="#"
-						onclick="' . htmlspecialchars($aOnClick) . '"
-						class="btn btn-default"
-						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.browse_' . ($mode == 'db' ? 'db' : 'file'))) . '">
-						' . IconUtility::getSpriteIcon('actions-insert-record') . '
-					</a>';
-			}
-			if (!$params['dontShowMoveIcons']) {
-				if ($sSize >= 5) {
-					$icons['L'][] = '
-						<a href="#"
-							class="btn btn-default t3-btn-moveoption-top"
-							data-fieldname="' . $fName . '"
-							title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_top')) . '">
-							' . IconUtility::getSpriteIcon('actions-move-to-top') . '
-						</a>';
+	protected function getDatabaseConnection() {
+		return $GLOBALS['TYPO3_DB'];
+	}
 
-				}
-				$icons['L'][] = '
-					<a href="#"
-						class="btn btn-default t3-btn-moveoption-up"
-						data-fieldname="' . $fName . '"
-						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_up')) . '">
-						' . IconUtility::getSpriteIcon('actions-move-up') . '
-					</a>';
-				$icons['L'][] = '
-					<a href="#"
-						class="btn btn-default t3-btn-moveoption-down"
-						data-fieldname="' . $fName . '"
-						title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_down')) . '">
-						' . IconUtility::getSpriteIcon('actions-move-down') . '
-					</a>';
-				if ($sSize >= 5) {
-					$icons['L'][] = '
-						<a href="#"
-							class="btn btn-default t3-btn-moveoption-bottom"
-							data-fieldname="' . $fName . '"
-							title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.move_to_bottom')) . '">
-							' . IconUtility::getSpriteIcon('actions-move-to-bottom') . '
-						</a>';
-				}
-			}
-			$clipElements = $this->getClipboardElements($allowed, $mode);
-			if (count($clipElements)) {
-				$aOnClick = '';
-				foreach ($clipElements as $elValue) {
-					if ($mode == 'db') {
-						list($itemTable, $itemUid) = explode('|', $elValue);
-						$recordTitle = BackendUtility::getRecordTitle($itemTable, BackendUtility::getRecordWSOL($itemTable, $itemUid));
-						$itemTitle = GeneralUtility::quoteJSvalue($recordTitle);
-						$elValue = $itemTable . '_' . $itemUid;
-					} else {
-						// 'file', 'file_reference' and 'folder' mode
-						$itemTitle = 'unescape(\'' . rawurlencode(basename($elValue)) . '\')';
-					}
-					$aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',unescape(\''
-						. rawurlencode(str_replace('%20', ' ', $elValue)) . '\'),' . $itemTitle . ',' . $itemTitle . ');';
-				}
-				$aOnClick .= 'return false;';
-				$icons['R'][] = '
-					<a href="#"
-						onclick="' . htmlspecialchars($aOnClick) . '"
-						title="' . htmlspecialchars(sprintf($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.clipInsert_' . ($mode == 'db' ? 'db' : 'file')), count($clipElements))) . '">
-						' . IconUtility::getSpriteIcon('actions-document-paste-into') . '
-					</a>';
-			}
-		}
-		if (!$params['readOnly'] && !$params['noDelete']) {
-			$icons['L'][] = '
-				<a href="#"
-					class="btn btn-default t3-btn-removeoption"
-					onClick="' . $rOnClickInline . '"
-					data-fieldname="' . $fName . '"
-					title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.remove_selected')) . '">
-					' . IconUtility::getSpriteIcon('actions-selection-delete') . '
-				</a>';
+	/**
+	 * @return LanguageService
+	 */
+	protected function getLanguageService() {
+		return $GLOBALS['LANG'];
+	}
 
-		}
+	/**
+	 * @return DocumentTemplate
+	 */
+	protected function getDocumentTemplate() {
+		return $GLOBALS['TBE_TEMPLATE'];
+	}
 
 
-		// Thumbnails
-		$imagesOnly = FALSE;
-		if ($params['thumbnails'] && $params['allowed']) {
-			// In case we have thumbnails, check if only images are allowed.
-			// In this case, render them below the field, instead of to the right
-			$allowedExtensionList = $params['allowed'];
-			$imageExtensionList = GeneralUtility::trimExplode(',', strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), TRUE);
-			$imagesOnly = TRUE;
-			foreach ($allowedExtensionList as $allowedExtension) {
-				if (!ArrayUtility::inArray($imageExtensionList, $allowedExtension)) {
-					$imagesOnly = FALSE;
-					break;
-				}
-			}
-		}
-		$thumbnails = '';
-		if (is_array($params['thumbnails']) && !empty($params['thumbnails'])) {
-			if ($imagesOnly) {
-				$thumbnails .= '<ul class="list-inline">';
-				foreach ($params['thumbnails'] as $thumbnail) {
-					$thumbnails .= '<li><span class="thumbnail">' . $thumbnail['image'] . '</span></li>';
-				}
-				$thumbnails .= '</ul>';
-			} else {
-				$thumbnails .= '<div class="table-fit"><table class="table table-white"><tbody>';
-				foreach ($params['thumbnails'] as $thumbnail) {
-					$thumbnails .= '
-						<tr>
-							<td class="col-icon">
-								' . ($config['internal_type'] === 'db'
-									? $this->getClickMenu($thumbnail['image'], $thumbnail['table'], $thumbnail['uid'])
-									: $thumbnail['image']) . '
-							</td>
-							<td class="col-title">
-								' . ($config['internal_type'] === 'db'
-									? $this->getClickMenu($thumbnail['name'], $thumbnail['table'], $thumbnail['uid'])
-									: $thumbnail['name']) . '
-								' . ($config['internal_type'] === 'db' ? '' : ' <span class="text-muted">[' . $thumbnail['uid'] . ']</span>') . '
-							</td>
-						</tr>
-						';
-				}
-				$thumbnails .= '</tbody></table></div>';
-			}
-		}
 
-		// Allowed Tables
-		$allowedTables = '';
-		if (is_array($params['allowedTables']) && !empty($params['allowedTables'])) {
-			$allowedTables .= '<div class="help-block">';
-			foreach ($params['allowedTables'] as $key => $item) {
-				if (is_array($item)) {
-					$allowedTables .= '<a href="#" onClick="' . htmlspecialchars($item['onClick']) . '" class="btn btn-default">' . $item['icon'] . ' ' . htmlspecialchars($item['name']) . '</a> ';
-				} elseif($key === 'name') {
-					$allowedTables .= '<span>' . htmlspecialchars($item) . '</span> ';
-				}
-			}
-			$allowedTables .= '</div>';
-		}
-		// Allowed
-		$allowedList = '';
-		if (is_array($params['allowed']) && !empty($params['allowed'])) {
-			foreach ($params['allowed'] as $item) {
-				$allowedList .= '<span class="label label-success">' . strtoupper($item) . '</span> ';
-			}
-		}
-		// Disallowed
-		$disallowedList = '';
-		if (is_array($params['disallowed']) && !empty($params['disallowed'])) {
-			foreach ($params['disallowed'] as $item) {
-				$disallowedList .= '<span class="label label-danger">' . strtoupper($item) . '</span> ';
-			}
-		}
-		// Rightbox
-		$rightbox = ($params['rightbox'] ?: '');
-
-		// Hook: dbFileIcons_postProcess (requested by FAL-team for use with the "fal" extension)
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'])) {
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'] as $classRef) {
-				$hookObject = GeneralUtility::getUserObj($classRef);
-				if (!$hookObject instanceof DatabaseFileIconsHookInterface) {
-					throw new \UnexpectedValueException('$hookObject must implement interface ' . \TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface::class, 1290167704);
-				}
-				$additionalParams = array(
-					'mode' => $mode,
-					'allowed' => $allowed,
-					'itemArray' => $itemArray,
-					'onFocus' => $onFocus,
-					'table' => $table,
-					'field' => $field,
-					'uid' => $uid,
-					'config' => $GLOBALS['TCA'][$table]['columns'][$field]
-				);
-				$hookObject->dbFileIcons_postProcess($params, $selector, $thumbnails, $icons, $rightbox, $fName, $uidList, $additionalParams, $this);
-			}
-		}
 
-		// Output
-		$str = '
-			' . ($params['headers']['selector'] ? '<label>' . $params['headers']['selector'] . '</label>' : '') . '
-			<div class="form-wizards-wrap form-wizards-aside">
-				<div class="form-wizards-element">
-					' . $selector . '
-					' . (!$params['noList'] && !empty($allowedTables) ? $allowedTables : '') . '
-					' . (!$params['noList'] && (!empty($allowedList) || !empty($disallowedList))
-						? '<div class="help-block">' . $allowedList . $disallowedList . ' </div>'
-						: '') . '
-				</div>
-				' . (!empty($icons['L']) ? '<div class="form-wizards-items"><div class="btn-group-vertical">' . implode('', $icons['L']) . '</div></div>' : '' ) . '
-				' . (!empty($icons['R']) ? '<div class="form-wizards-items"><div class="btn-group-vertical">' . implode('', $icons['R']) . '</div></div>' : '' ) . '
-			</div>
-			';
-		if ($rightbox) {
-			$str = '
-				<div class="form-multigroup-wrap t3js-formengine-field-group">
-					<div class="form-multigroup-item form-multigroup-element">' . $str . '</div>
-					<div class="form-multigroup-item form-multigroup-element">
-						' . ($params['headers']['items'] ? '<label>' . $params['headers']['items'] . '</label>' : '') . '
-						' . ($params['headers']['selectorbox'] ? '<div class="form-multigroup-item-wizard">' . $params['headers']['selectorbox'] . '</div>' : '') . '
-						' . $rightbox . '
-					</div>
-				</div>
-				';
-		}
-		$str .= $thumbnails;
 
-		// Creating the hidden field which contains the actual value as a comma list.
-		$str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />';
-		return $str;
-	}
 
 	/**
-	 * Returns array of elements from clipboard to insert into GROUP element box.
-	 *
-	 * @param string $allowed Allowed elements, Eg "pages,tt_content", "gif,jpg,jpeg,png
-	 * @param string $mode Mode of relations: "db" or "file
-	 * @return array Array of elements in values (keys are insignificant), if none found, empty array.
+	 * All properties and methods below are deprecated since TYPO3 CMS 7 and will be removed in TYPO3 CMS 8
 	 */
-	public function getClipboardElements($allowed, $mode) {
-		$output = array();
-		if (is_object($this->clipObj)) {
-			switch ($mode) {
-				case 'file_reference':
-
-				case 'file':
-					$elFromTable = $this->clipObj->elFromTable('_FILE');
-					$allowedExts = GeneralUtility::trimExplode(',', $allowed, TRUE);
-					// If there are a set of allowed extensions, filter the content:
-					if ($allowedExts) {
-						foreach ($elFromTable as $elValue) {
-							$pI = pathinfo($elValue);
-							$ext = strtolower($pI['extension']);
-							if (in_array($ext, $allowedExts)) {
-								$output[] = $elValue;
-							}
-						}
-					} else {
-						// If all is allowed, insert all: (This does NOT respect any disallowed extensions,
-						// but those will be filtered away by the backend TCEmain)
-						$output = $elFromTable;
-					}
-					break;
-				case 'db':
-					$allowedTables = GeneralUtility::trimExplode(',', $allowed, TRUE);
-					// All tables allowed for relation:
-					if (trim($allowedTables[0]) === '*') {
-						$output = $this->clipObj->elFromTable('');
-					} else {
-						// Only some tables, filter them:
-						foreach ($allowedTables as $tablename) {
-							$elFromTable = $this->clipObj->elFromTable($tablename);
-							$output = array_merge($output, $elFromTable);
-						}
-					}
-					$output = array_keys($output);
-					break;
-			}
-		}
-		return $output;
-	}
+
+
 
 	/**
-	 * Wraps the icon of a relation item (database record or file) in a link opening the context menu for the item.
-	 * Icons will be wrapped only if $this->enableClickMenu is set. This must be done only if a global SOBE object
-	 * exists and if the necessary JavaScript for displaying the context menus has been added to the page properties.
-	 *
-	 * @param string $str The icon HTML to wrap
-	 * @param string $table Table name (eg. "pages" or "tt_content") OR the absolute path to the file
-	 * @param int $uid The uid of the record OR if file, just blank value.
-	 * @return string HTML
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getClickMenu($str, $table, $uid = 0) {
-		if ($this->enableClickMenu) {
-			return $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($str, $table, $uid, 1, '', '+copy,info,edit,view');
-		}
-		return '';
-	}
+	public $printNeededJS = array();
 
 	/**
-	 * Rendering wizards for form fields.
-	 *
-	 * @param array $itemKinds Array with the real item in the first value, and an alternative item in the second value.
-	 * @param array $wizConf The "wizard" key from the config array for the field (from TCA)
-	 * @param string $table Table name
-	 * @param array $row The record array
-	 * @param string $field The field name
-	 * @param array $PA Additional configuration array. (passed by reference!)
-	 * @param string $itemName The field name
-	 * @param array $specConf Special configuration if available.
-	 * @param bool $RTE Whether the RTE could have been loaded.
-	 * @return string The new item value.
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function renderWizards($itemKinds, $wizConf, $table, $row, $field, &$PA, $itemName, $specConf, $RTE = FALSE) {
-		// Init:
-		$fieldChangeFunc = $PA['fieldChangeFunc'];
-		$item = $itemKinds[0];
-		$outArr = array(
-			'buttons' => '',
-			'additional' => ''
-		);
-		$colorBoxLinks = array();
-		$fName = '[' . $table . '][' . $row['uid'] . '][' . $field . ']';
-		$md5ID = 'ID' . GeneralUtility::shortmd5($itemName);
-		$listFlag = '_list';
-		$fieldConfig = $PA['fieldConf']['config'];
-		$prefixOfFormElName = 'data[' . $table . '][' . $row['uid'] . '][' . $field . ']';
-		$flexFormPath = '';
-		if (GeneralUtility::isFirstPartOfStr($PA['itemFormElName'], $prefixOfFormElName)) {
-			$flexFormPath = str_replace('][', '/', substr($PA['itemFormElName'], strlen($prefixOfFormElName) + 1, -1));
-		}
-		// Manipulate the field name (to be the TRUE form field name) and remove
-		// a suffix-value if the item is a selector box with renderMode "singlebox":
-		if ($PA['fieldConf']['config']['form_type'] == 'select') {
-			// Single select situation:
-			if ($PA['fieldConf']['config']['maxitems'] <= 1) {
-				$listFlag = '';
-			} elseif ($PA['fieldConf']['config']['renderMode'] == 'singlebox') {
-				$itemName .= '[]';
-				$listFlag = '';
-			}
-		}
-		// Traverse wizards:
-		if (is_array($wizConf) && !$this->disableWizards) {
-			$parametersOfWizards = &$specConf['wizards']['parameters'];
-			foreach ($wizConf as $wid => $wConf) {
-				if (
-					$wid[0] !== '_' && (!$wConf['enableByTypeConfig']
-					|| is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) && ($RTE || !$wConf['RTEonly'])
-				) {
-					// Title / icon:
-					$iTitle = htmlspecialchars($this->getLanguageService()->sL($wConf['title']));
-					if ($wConf['icon']) {
-						$icon = $this->getIconHtml($wConf['icon'], $iTitle, $iTitle);
-					} else {
-						$icon = $iTitle;
-					}
-					switch ((string)$wConf['type']) {
-						case 'userFunc':
+	public $palFieldArr = array();
+
+	/**
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $isPalettedoc = FALSE;
+
+	/**
+	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $paletteMargin = 1;
 
-						case 'script':
+	/**
+	 * @var string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $defStyle = '';
 
-						case 'popup':
+	/**
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $cachedTSconfig = array();
 
-						case 'colorbox':
+	/**
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $cachedLanguageFlag = array();
 
-						case 'slider':
-							if (!$wConf['notNewRecords'] || MathUtility::canBeInterpretedAsInteger($row['uid'])) {
-								// Setting &P array contents:
-								$params = array();
-								// Including the full fieldConfig from TCA may produce too long an URL
-								if ($wid != 'RTE') {
-									$params['fieldConfig'] = $fieldConfig;
-								}
-								$params['params'] = $wConf['params'];
-								$params['exampleImg'] = $wConf['exampleImg'];
-								$params['table'] = $table;
-								$params['uid'] = $row['uid'];
-								$params['pid'] = $row['pid'];
-								$params['field'] = $field;
-								$params['flexFormPath'] = $flexFormPath;
-								$params['md5ID'] = $md5ID;
-								$params['returnUrl'] = $this->thisReturnUrl();
-
-								$wScript = '';
-								// Resolving script filename and setting URL.
-								if (isset($wConf['module']['name'])) {
-									$urlParameters = array();
-									if (isset($wConf['module']['urlParameters']) && is_array($wConf['module']['urlParameters'])) {
-										$urlParameters = $wConf['module']['urlParameters'];
-									}
-									$wScript = BackendUtility::getModuleUrl($wConf['module']['name'], $urlParameters, $this->backPath);
-								} elseif (in_array($wConf['type'], array('script', 'colorbox', 'popup'), TRUE)) {
-									// Illegal configuration, fail silently
-									break;
-								}
-								$url = ($wScript ?: $this->backPath) . (strstr($wScript, '?') ? '' : '?');
-								// If "script" type, create the links around the icon:
-								if ((string)$wConf['type'] === 'script') {
-									$aUrl = $url . GeneralUtility::implodeArrayForUrl('', array('P' => $params));
-									$outArr['buttons'][] = ' <a class="btn btn-default" href="' . htmlspecialchars($aUrl) . '" onclick="this.blur(); return !TBE_EDITOR.isFormChanged();">' . $icon . '</a>';
-								} else {
-									// ... else types "popup", "colorbox" and "userFunc" will need additional parameters:
-									$params['formName'] = $this->formName;
-									$params['itemName'] = $itemName;
-									$params['hmac'] = GeneralUtility::hmac($params['formName'] . $params['itemName'], 'wizard_js');
-									$params['fieldChangeFunc'] = $fieldChangeFunc;
-									$params['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($fieldChangeFunc));
-									switch ((string)$wConf['type']) {
-										case 'popup':
-										case 'colorbox':
-											// Current form value is passed as P[currentValue]!
-											$addJS = $wConf['popup_onlyOpenIfSelected']
-												? 'if (!TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')){alert('
-													. GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.noSelItemForEdit'))
-													. '); return false;}'
-												: '';
-											$curSelectedValues = '+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\'' . $itemName . $listFlag . '\')';
-											$aOnClick = 'this.blur();' . $addJS . 'vHWin=window.open(\'' . $url
-												. GeneralUtility::implodeArrayForUrl('', array('P' => $params))
-												. '\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode('
-												. $this->elName($itemName) . '.value,200)' . $curSelectedValues
-												. ',\'popUp' . $md5ID . '\',\'' . $wConf['JSopenParams'] . '\');'
-												. 'vHWin.focus();return false;';
-											// Setting "colorBoxLinks" - user LATER to wrap around the color box as well:
-											$colorBoxLinks = array('<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($aOnClick) . '">', '</a>');
-											if ((string)$wConf['type'] == 'popup') {
-												$outArr['buttons'][] = $colorBoxLinks[0] . $icon . $colorBoxLinks[1];
-											}
-											break;
-										case 'userFunc':
-											// Reference set!
-											$params['item'] = &$item;
-											$params['icon'] = $icon;
-											$params['iTitle'] = $iTitle;
-											$params['wConf'] = $wConf;
-											$params['row'] = $row;
-											$outArr['additional'][] = GeneralUtility::callUserFunction($wConf['userFunc'], $params, $this);
-											break;
-										case 'slider':
-											// Prevent vertical alignment
-											$verticalAlignmentIsPossible = FALSE;
-
-											// Reference set!
-											$params['item'] = &$item;
-											$params['icon'] = $icon;
-											$params['iTitle'] = $iTitle;
-											$params['wConf'] = $wConf;
-											$params['row'] = $row;
-											$wizard = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\ValueSlider::class);
-											$outArr['additional'][] = call_user_func_array(array(&$wizard, 'renderWizard'), array(&$params, &$this));
-											break;
-									}
-								}
-								// Hide the real form element?
-								if (is_array($wConf['hideParent']) || $wConf['hideParent']) {
-									// Setting the item to a hidden-field.
-									$item = $itemKinds[1];
-									if (is_array($wConf['hideParent'])) {
-										$item .= $this->getSingleField_typeNone_render($wConf['hideParent'], $PA['itemFormElValue']);
-									}
-								}
-							}
-							break;
-						case 'select':
-							$fieldValue = array('config' => $wConf);
-							$TSconfig = $this->setTSconfig($table, $row);
-							$TSconfig[$field] = $TSconfig[$field]['wizards.'][$wid . '.'];
-							$selItems = $this->addSelectOptionsToItemArray($this->initItemArray($fieldValue), $fieldValue, $TSconfig, $field);
-							// Process items by a user function:
-							if (!empty($wConf['itemsProcFunc'])) {
-								$funcConfig = !empty($wConf['itemsProcFunc.']) ? $wConf['itemsProcFunc.'] : array();
-								$selItems = $this->procItems($selItems, $funcConfig, $wConf, $table, $row, $field);
-							}
-							$opt = array();
-							$opt[] = '<option>' . $iTitle . '</option>';
-							foreach ($selItems as $p) {
-								$opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>';
-							}
-							if ($wConf['mode'] == 'append') {
-								$assignValue = $this->elName($itemName) . '.value=\'\'+this.options[this.selectedIndex].value+' . $this->elName($itemName) . '.value';
-							} elseif ($wConf['mode'] == 'prepend') {
-								$assignValue = $this->elName($itemName) . '.value+=\'\'+this.options[this.selectedIndex].value';
-							} else {
-								$assignValue = $this->elName($itemName) . '.value=this.options[this.selectedIndex].value';
-							}
-							$sOnChange = $assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc);
-							$outArr['additional'][] = '<select id="' . str_replace('.', '', uniqid('tceforms-select-', TRUE))
-								. '" class="form-control tceforms-select tceforms-wizardselect" name="_WIZARD' . $fName . '" onchange="'
-								. htmlspecialchars($sOnChange) . '">' . implode('', $opt) . '</select>';
-							break;
-						case 'suggest':
-							if (!empty($PA['fieldTSConfig']['suggest.']['default.']['hide'])) {
-								break;
-							}
-							$outArr['additional'][] = $this->suggest->renderSuggestSelector($PA['itemFormElName'], $table, $field, $row, $PA);
-							break;
-					}
-					// Color wizard colorbox:
-					if ((string)$wConf['type'] === 'colorbox') {
-						$dim = GeneralUtility::intExplode('x', $wConf['dim']);
-						$dX = MathUtility::forceIntegerInRange($dim[0], 1, 200, 20);
-						$dY = MathUtility::forceIntegerInRange($dim[1], 1, 200, 20);
-						$color = $PA['itemFormElValue'] ? ' bgcolor="' . htmlspecialchars($PA['itemFormElValue']) . '"' : '';
-						$skinImg = IconUtility::skinImg(
-							$this->backPath,
-							$color === '' ? 'gfx/colorpicker_empty.png' : 'gfx/colorpicker.png',
-							'width="' . $dX . '" height="' . $dY . '"' . BackendUtility::titleAltAttrib(trim($iTitle . ' ' . $PA['itemFormElValue'])) . ' border="0"'
-						);
-						$outArr['additional'][] = '<table border="0" cellpadding="0" cellspacing="0" id="' . $md5ID . '"' . $color
-							. ' style="' . htmlspecialchars($wConf['tableStyle']) . '">
-									<tr>
-										<td>' . $colorBoxLinks[0] . '<img ' . $skinImg . '>' . $colorBoxLinks[1] . '</td>
-									</tr>
-								</table>';
-					}
-				}
-			}
-			// For each rendered wizard, put them together around the item.
-			if (count($outArr['buttons']) || count($outArr['additional'])) {
-				if ($wizConf['_HIDDENFIELD']) {
-					$item = $itemKinds[1];
-				}
+	/**
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $cachedTSconfig_fieldLevel = array();
 
-				$outStr = '';
-				if (!empty($outArr['buttons'])) {
-					$outStr .= '<div class="btn-group' . ($wizConf['_VERTICAL'] ? ' btn-group-vertical' : '') . '">' . implode('', $outArr['buttons']) . '</div>';
-				}
-				if (!empty($outArr['additional'])) {
-					$outStr .= implode(' ', $outArr['additional']);
-				}
+	/**
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $transformedRow = array();
 
-				// Position
-				$class = array();
-				if ($wizConf['_POSITION'] === 'left') {
-					$class[] = 'form-wizards-aside';
-					$outStr = '<div class="form-wizards-items">' . $outStr . '</div><div class="form-wizards-element">' . $item . '</div>';
-				} elseif ($wizConf['_POSITION'] === 'top') {
-					$class[] = 'form-wizards-top';
-					$outStr = '<div class="form-wizards-items">' . $outStr . '</div><div class="form-wizards-element">' . $item . '</div>';
-				} elseif ($wizConf['_POSITION'] === 'bottom') {
-					$class[] = 'form-wizards-bottom';
-					$outStr = '<div class="form-wizards-element">' . $item . '</div><div class="form-wizards-items">' . $outStr . '</div>';
-				} else {
-					$class[] = 'form-wizards-aside';
-					$outStr = '<div class="form-wizards-element">' . $item . '</div><div class="form-wizards-items">' . $outStr . '</div>';
-				}
-				$item = '
-					<!-- renderWizards -->
-					<div class="form-wizards-wrap ' . (!empty($class) ? implode(' ', $class) : '' ) . '">
-						' . $outStr . '
-					</div>';
-			}
-		}
-		return $item;
-	}
+	/**
+	 * Set this to the 'backPath' pointing back to the typo3 admin directory
+	 * from the script where this form is displayed.
+	 *
+	 * @var string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $backPath = '';
 
 	/**
-	 * Get icon (for example for selector boxes)
+	 * If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!)
 	 *
-	 * @param string $icon Icon reference
-	 * @return array Array with two values; the icon file reference (relative to PATH_typo3 minus backPath), the icon file information array (getimagesize())
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getIcon($icon) {
-		$selIconInfo = FALSE;
-		if (substr($icon, 0, 4) == 'EXT:') {
-			$file = GeneralUtility::getFileAbsFileName($icon);
-			if ($file) {
-				$file = PathUtility::stripPathSitePrefix($file);
-				$selIconFile = $this->backPath . '../' . $file;
-				$selIconInfo = @getimagesize((PATH_site . $file));
-			} else {
-				$selIconFile = '';
-			}
-		} elseif (substr($icon, 0, 3) == '../') {
-			$selIconFile = $this->backPath . GeneralUtility::resolveBackPath($icon);
-			if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
-				$selIconInfo = getimagesize((PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3))));
-			}
-		} elseif (substr($icon, 0, 4) == 'ext/' || substr($icon, 0, 7) == 'sysext/') {
-			$selIconFile = $this->backPath . $icon;
-			if (is_file(PATH_typo3 . $icon)) {
-				$selIconInfo = getimagesize(PATH_typo3 . $icon);
-			}
-		} else {
-			$selIconFile = IconUtility::skinImg($this->backPath, 'gfx/' . $icon, '', 1);
-			$iconPath = substr($selIconFile, strlen($this->backPath));
-			if (is_file(PATH_typo3 . $iconPath)) {
-				$selIconInfo = getimagesize(PATH_typo3 . $iconPath);
-			}
-		}
-		if ($selIconInfo === FALSE) {
-			// Unset to empty string if icon is not available
-			$selIconFile = '';
-		}
-		return array($selIconFile, $selIconInfo);
-	}
+	public $disableRTE = FALSE;
 
 	/**
-	 * Renders the $icon, supports a filename for skinImg or sprite-icon-name
+	 * If FALSE, then all CSH will be disabled
 	 *
-	 * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
-	 * @param string $alt Alt attribute of the icon returned
-	 * @param string $title Title attribute of the icon return
-	 * @return string A tag representing to show the asked icon
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getIconHtml($icon, $alt = '', $title = '') {
-		$iconArray = $this->getIcon($icon);
-		if (!empty($iconArray[0]) && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . PATH_typo3_mod . $iconArray[0]))) {
-			return '<img src="' . $iconArray[0] . '" alt="' . $alt . '" ' . ($title ? 'title="' . $title . '"' : '') . ' />';
-		} else {
-			return IconUtility::getSpriteIcon($icon, array('alt' => $alt, 'title' => $title));
-		}
-	}
+	public $globalShowHelp = TRUE;
 
 	/**
-	 * Creates style attribute content for option tags in a selector box, primarily setting
-	 * it up to show the icon of an element as background image (works in mozilla)
+	 * If set to FALSE, palettes will NEVER be rendered.
 	 *
-	 * @param string $iconString Icon string for option item
-	 * @return string Style attribute content, if any
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function optionTagStyle($iconString) {
-		if (!$iconString) {
-			return '';
-		}
-		list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-		if (empty($selIconFile)) {
-			// Skip background style if image is unavailable
-			return '';
-		}
-		$padLeft = $selIconInfo[0] + 4;
-		if ($padLeft >= 18 && $padLeft <= 24) {
-			// In order to get the same padding for all option tags even if icon sizes differ a little,
-			// set it to 22 if it was between 18 and 24 pixels
-			$padLeft = 22;
-		}
-		$padTop = MathUtility::forceIntegerInRange(($selIconInfo[1] - 12) / 2, 0);
-		$styleAttr = 'background: #fff url(' . $selIconFile . ') 0% 50% no-repeat; height: '
-			. MathUtility::forceIntegerInRange(($selIconInfo[1] + 2 - $padTop), 0)
-			. 'px; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;';
-		return $styleAttr;
-	}
+	public $doPrintPalette = TRUE;
 
 	/**
-	 * Creates style attribute content for optgroup tags in a selector box, primarily setting it
-	 * up to show the icon of an element as background image (works in mozilla).
+	 * Enable click menu on reference icons.
 	 *
-	 * @param string $iconString Icon string for option item
-	 * @return string Style attribute content, if any
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function optgroupTagStyle($iconString) {
-		if (!$iconString) {
-			return '';
-		}
-		list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-		if (empty($selIconFile)) {
-			// Skip background style if image is unavailable
-			return '';
-		}
-		$padLeft = $selIconInfo[0] + 4;
-		if ($padLeft >= 18 && $padLeft <= 24) {
-			// In order to get the same padding for all option tags even if icon sizes differ a little,
-			// set it to 22, if it was between 18 and 24 pixels.
-			$padLeft = 22;
-		}
-		$padTop = MathUtility::forceIntegerInRange(($selIconInfo[1] - 12) / 2, 0);
-		return 'background: #ffffff url(' . $selIconFile . ') 0 0 no-repeat; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;';
-	}
+	public $enableClickMenu = FALSE;
 
 	/**
-	 * Extracting values from a value/label list (as made by transferData class)
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $enableTabMenu = FALSE;
+
+	/**
+	 * Form field width compensation: Factor of "size=12" to "style="width: 12*12px"
+	 * for form field widths of style-aware browsers
 	 *
-	 * @param array $itemFormElValue Values in an array
-	 * @return array Input string exploded with comma and for each value only the label part is set in the array. Keys are numeric
+	 * @var float
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function extractValuesOnlyFromValueLabelList($itemFormElValue) {
-		// Get values of selected items:
-		$itemArray = GeneralUtility::trimExplode(',', $itemFormElValue, TRUE);
-		foreach ($itemArray as $tk => $tv) {
-			$tvP = explode('|', $tv, 2);
-			$tvP[0] = rawurldecode($tvP[0]);
-			$itemArray[$tk] = $tvP[0];
-		}
-		return $itemArray;
-	}
+	public $form_rowsToStylewidth = 12;
 
 	/**
-	 * Add the id and the style property to the field palette
+	 * Value that gets added for style="width: ...px" for textareas compared to input fields.
 	 *
-	 * @param string $code Palette Code
-	 * @param string $id Collapsible ID
-	 * @param string $collapsed Collapsed status
-	 * @return bool Is collapsed
+	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function wrapCollapsiblePalette($code, $id, $collapsed) {
-		$display = $collapsed ? '' : ' in';
-		$id = str_replace('.', '', $id);
-		$out = '
-			<!-- wrapCollapsiblePalette -->
-			<p>
-				<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#' . $id . '" aria-expanded="false" aria-controls="' . $id . '">
-					' . IconUtility::getSpriteIcon('actions-system-options-view') . '
-					' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.moreOptions')) . '
-				</button>
-			</p>
-			<div id="' . $id . '" class="form-section-collapse collapse' . $display . '">
-				<div class="row">' . $code . '</div>
-			</div>';
-		return $out;
-	}
+	protected $form_additionalTextareaStyleWidth = 23;
 
+	/**
+	 * Form field width compensation: Compensation for large documents, doc-tab (editing)
+	 *
+	 * @var float
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $form_largeComp = 1.33;
 
 	/**
-	 * Wraps a string with a link to the palette.
+	 * The number of chars expected per row when the height of a text area field is
+	 * automatically calculated based on the number of characters found in the field content.
 	 *
-	 * @param string $header The string to wrap in an A-tag
-	 * @param string $table The table name for which to open the palette.
-	 * @param array $row The palette pointer.
-	 * @param int $palette The record array
-	 * @param mixed $retFunc Not used
-	 * @return array
+	 * @var int
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function wrapOpenPalette($header, $table, $row, $palette, $retFunc) {
-		GeneralUtility::logDeprecatedFunction();
-		$id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid'];
-		$res = '<a href="#" onclick="TBE_EDITOR.toggle_display_states(\'' . $id . '\',\'block\',\'none\'); return false;" >' . $header . '</a>';
-		return array($res, '');
-	}
+	public $charsPerRow = 40;
 
 	/**
-	 * Add the id and the style property to the field palette
+	 * The maximum abstract value for textareas
 	 *
-	 * @param string $code Palette Code
-	 * @param string $table The table name for which to open the palette.
-	 * @param string $row Palette ID
-	 * @param string $palette The record array
-	 * @param bool $collapsed TRUE if collapsed
-	 * @return bool Is collapsed
+	 * @var int
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function wrapPaletteField($code, $table, $row, $palette, $collapsed) {
-		GeneralUtility::logDeprecatedFunction();
-		$display = $collapsed ? 'none' : 'block';
-		$id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid'];
-		$code = '<div id="' . $id . '" style="display:' . $display . ';" >' . $code . '</div>';
-		return $code;
-	}
+	public $maxTextareaWidth = 48;
 
 	/**
-	 * Returns element reference for form element name
+	 * The default abstract value for input and textarea elements
 	 *
-	 * @param string $itemName Form element name
-	 * @return string Form element reference (JS)
+	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function elName($itemName) {
-		return 'document.' . $this->formName . '[\'' . $itemName . '\']';
-	}
+	public $defaultInputWidth = 30;
 
 	/**
-	 * Returns the "returnUrl" of the form. Can be set externally or will be taken from "GeneralUtility::linkThisScript()"
+	 * The minimum abstract value for input and textarea elements
 	 *
-	 * @return string Return URL of current script
+	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function thisReturnUrl() {
-		return $this->returnUrl ? $this->returnUrl : GeneralUtility::linkThisScript();
-	}
+	public $minimumInputWidth = 10;
 
 	/**
-	 * Returns the form field for a single HIDDEN field.
-	 * (Not used anywhere...?)
+	 * The maximum abstract value for input and textarea elements
 	 *
-	 * @param string $table Table name
-	 * @param string $field Field name
-	 * @param array $row The row
-	 * @return string The hidden-field <input> tag.
+	 * @var int
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getSingleHiddenField($table, $field, $row) {
-		$item = '';
-		if ($GLOBALS['TCA'][$table]['columns'][$field]) {
-			$uid = $row['uid'];
-			$itemName = $this->prependFormFieldNames . '[' . $table . '][' . $uid . '][' . $field . ']';
-			$itemValue = $row[$field];
-			$item = '<input type="hidden" name="' . $itemName . '" value="' . htmlspecialchars($itemValue) . '" />';
-		}
-		return $item;
-	}
+	public $maxInputWidth = 50;
 
 	/**
-	 * Returns the max-width in pixels for a <input>/<textarea>-element
+	 * Default style for the selector boxes used for multiple items in "select" and "group" types.
 	 *
-	 * @param int $size The abstract size value (1-48)
-	 * @return int max-width in pixels
-	 * @internal
+	 * @var string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formMaxWidth($size = 48) {
-		$size = round($size * $this->form_largeComp);
-		$width = ceil($size * $this->form_rowsToStylewidth);
-		return $width;
-	}
+	public $defaultMultipleSelectorStyle = '';
 
 	/**
-	 * Returns parameters to set the width for a <input>/<textarea>-element
+	 * The name attribute of the form
 	 *
-	 * @param int $size The abstract size value (1-48)
-	 * @param bool $textarea If this is for a text area.
-	 * @return string Either a "style" attribute string or "cols"/"size" attribute string.
+	 * @var string
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formWidth($size = 48, $textarea = FALSE) {
-		GeneralUtility::logDeprecatedFunction();
-		$fieldWidthAndStyle = $this->formWidthAsArray($size, $textarea);
-		// Setting width by style-attribute. 'cols' MUST be avoided with NN6+
-		$widthAndStyleAttributes = ' style="' . htmlspecialchars($fieldWidthAndStyle['style']) . '"';
-		if ($fieldWidthAndStyle['class']) {
-			$widthAndStyleAttributes .= ' class="' . htmlspecialchars($fieldWidthAndStyle['class']) . '"';
-		}
-		return $widthAndStyleAttributes;
-	}
+	public $formName = 'editform';
 
 	/**
-	 * Returns parameters to set the width for a <input>/<textarea>-element
+	 * Used to indicate the mode of CSH (Context Sensitive Help),
+	 * whether it should be icons-only ('icon') or not at all (blank).
 	 *
-	 * @param int $size The abstract size value (1-48)
-	 * @param bool $textarea If set, calculates sizes for a text area.
-	 * @return array An array containing style, class, and width attributes.
+	 * @var bool
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formWidthAsArray($size = 48, $textarea = FALSE) {
-		GeneralUtility::logDeprecatedFunction();
-		$fieldWidthAndStyle = array('style' => '', 'class' => '', 'width' => '');
-		$widthInPixels = $this->formMaxWidth($size);
-		$fieldWidthAndStyle['style'] = 'width: ' . $widthInPixels . 'px; ';
-		$fieldWidthAndStyle['class'] = 'formfield-' . ($textarea ? 'text' : 'input');
-		return $fieldWidthAndStyle;
-	}
+	public $edit_showFieldHelp = FALSE;
+
+	/**
+	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $edit_docModuleUpload = FALSE;
+
+	/**
+	 * Loaded with info about the browser when class is instantiated
+	 *
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public $clientInfo = array();
 
 	/**
-	 * Get style CSS values for the current field type.
+	 * TRUE, if RTE is possible for the current user (based on result from BE_USER->isRTE())
 	 *
-	 * @param string $type Field type (eg. "check", "radio", "select")
-	 * @return string CSS attributes
-	 * @see formElStyleClassValue()
+	 * @var bool
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formElStyle($type) {
-		GeneralUtility::logDeprecatedFunction();
-		return $this->formElStyleClassValue($type);
-	}
+	public $RTEenabled = FALSE;
 
 	/**
-	 * Get class attribute value for the current field type.
+	 * If $this->RTEenabled was FALSE, you can find the reasons listed in this array
+	 * which is filled with reasons why the RTE could not be loaded)
 	 *
-	 * @param string $type Field type (eg. "check", "radio", "select")
-	 * @return string CSS attributes
-	 * @see formElStyleClassValue()
+	 * @var string
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formElClass($type) {
-		GeneralUtility::logDeprecatedFunction();
-		return $this->formElStyleClassValue($type, TRUE);
-	}
+	public $RTEenabled_notReasons = '';
 
 	/**
-	 * Get style CSS values for the current field type.
+	 * Contains current color scheme
 	 *
-	 * @param string $type Field type (eg. "check", "radio", "select")
-	 * @param bool $class If set, will return value only if prefixed with CLASS, otherwise must not be prefixed "CLASS
-	 * @return string CSS attributes
+	 * @var array
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function formElStyleClassValue($type, $class = FALSE) {
-		GeneralUtility::logDeprecatedFunction();
-		// Get value according to field:
-		if (isset($this->fieldStyle[$type])) {
-			$style = trim($this->fieldStyle[$type]);
-		} else {
-			$style = trim($this->fieldStyle['all']);
-		}
-		// Check class prefixed:
-		if (substr($style, 0, 6) == 'CLASS:') {
-			$out = $class ? trim(substr($style, 6)) : '';
-		} else {
-			$out = !$class ? $style : '';
-		}
-		return $out;
-	}
+	public $colorScheme = array();
 
 	/**
-	 * Return default "style" / "class" attribute line.
+	 * Contains current class scheme
 	 *
-	 * @param string $type Field type (eg. "check", "radio", "select")
-	 * @param string $additionalClass Additional class(es) to be added
-	 * @return string CSS attributes
+	 * @var array
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function insertDefStyle($type, $additionalClass = '') {
-		GeneralUtility::logDeprecatedFunction();
-		$cssClasses = trim('t3-formengine-field-' . $type . ' ' . $additionalClass);
-		return 'class="' . htmlspecialchars($cssClasses) . '"';
-	}
+	public $classScheme = array();
 
 	/**
-	 * Create dynamic tab menu
+	 * Contains the default color scheme
 	 *
-	 * @param array $parts Parts for the tab menu, fed to template::getDynTabMenu()
-	 * @param string $idString ID string for the tab menu
-	 * @param int $dividersToTabsBehaviour If set to '1' empty tabs will be removed, If set to '2' empty tabs will be disabled, deprecated, and not in use anymore since TYPO3 CMS 7
-	 * @return string HTML for the menu
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getDynTabMenu($parts, $idString, $dividersToTabsBehaviour = -1) {
-		// if the third (obsolete) parameter is used, throw a deprecation warning
-		if ($dividersToTabsBehaviour !== -1) {
-			GeneralUtility::deprecationLog('The parameter $dividersToTabsBehaviour in FormEngine::getDynTabMenu is deprecated. Please remove this option from your code');
-		}
-		$docTemplate = $this->getDocumentTemplate();
-		if (is_object($docTemplate)) {
-			$docTemplate->backPath = $this->backPath;
-			return $docTemplate->getDynTabMenu($parts, $idString, 0, FALSE, 1, FALSE, 1);
-		} else {
-			$output = '';
-			foreach ($parts as $singlePad) {
-				$output .= '
-				<h3>' . htmlspecialchars($singlePad['label']) . '</h3>
-				' . ($singlePad['description'] ? '<p class="c-descr">' . nl2br(htmlspecialchars($singlePad['description'])) . '</p>' : '') . '
-				' . $singlePad['content'];
-			}
-			return '<div class="tab-content">' . $output . '</div>';
-		}
-	}
+	public $defColorScheme = array();
 
-	/************************************************************
-	 *
-	 * Item-array manipulation functions (check/select/radio)
-	 *
-	 ************************************************************/
 	/**
-	 * Initialize item array (for checkbox, selectorbox, radio buttons)
-	 * Will resolve the label value.
+	 * Contains the default class scheme
 	 *
-	 * @param array $fieldValue The "columns" array for the field (from TCA)
-	 * @return array An array of arrays with three elements; label, value, icon
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function initItemArray($fieldValue) {
-		$languageService = $this->getLanguageService();
-		$items = array();
-		if (is_array($fieldValue['config']['items'])) {
-			foreach ($fieldValue['config']['items'] as $itemValue) {
-				$items[] = array($languageService->sL($itemValue[0]), $itemValue[1], $itemValue[2]);
-			}
-		}
-		return $items;
-	}
+	public $defClassScheme = array();
 
 	/**
-	 * Merges items into an item-array, optionally with an icon
-	 * example:
-	 * TCEFORM.pages.doktype.addItems.13 = My Label
-	 * TCEFORM.pages.doktype.addItems.13.icon = EXT:t3skin/icons/gfx/i/pages.gif
+	 * Contains field style values
 	 *
-	 * @param array $items The existing item array
-	 * @param array $iArray An array of items to add. NOTICE: The keys are mapped to values, and the values and mapped to be labels. No possibility of adding an icon.
-	 * @return array The updated $item array
+	 * @var array|NULL
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	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
-				// like "34.icon = mylabel.png", skip it (see its usage below)
-				if (is_array($label)) {
-					continue;
-				}
-				// check if the value "34 = mylabel" also has a "34.icon = myimage.png"
-				if (isset($iArray[$value . '.']) && $iArray[$value . '.']['icon']) {
-					$icon = $iArray[$value . '.']['icon'];
-				} else {
-					$icon = '';
-				}
-				$items[] = array($languageService->sL($label), $value, $icon);
-			}
-		}
-		return $items;
-	}
+	public $fieldStyle = NULL;
 
 	/**
-	 * Perform user processing of the items arrays of checkboxes, selectorboxes and radio buttons.
+	 * Contains border style values
 	 *
-	 * @param array $items The array of items (label,value,icon)
-	 * @param array $iArray The "itemsProcFunc." from fieldTSconfig of the field.
-	 * @param array $config The config array for the field.
-	 * @param string $table Table name
-	 * @param array $row Record row
-	 * @param string $field Field name
-	 * @return array The modified $items array
+	 * @var array|NULL
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function procItems($items, $iArray, $config, $table, $row, $field) {
-		$languageService = $this->getLanguageService();
-		$params = array();
-		$params['items'] = &$items;
-		$params['config'] = $config;
-		$params['TSconfig'] = $iArray;
-		$params['table'] = $table;
-		$params['row'] = $row;
-		$params['field'] = $field;
-		// The itemsProcFunc method may throw an exception.
-		// If it does display an error message and return items unchanged.
-		try {
-			GeneralUtility::callUserFunction($config['itemsProcFunc'], $params, $this);
-		} catch (\Exception $exception) {
-			$fieldLabel = $field;
-			if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) {
-				$fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']);
-			}
-			$message = sprintf(
-				$languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.items_proc_func_error'),
-				$fieldLabel,
-				$exception->getMessage()
-			);
-			/** @var $flashMessage FlashMessage */
-			$flashMessage = GeneralUtility::makeInstance(
-				FlashMessage::class,
-				htmlspecialchars($message),
-				'',
-				FlashMessage::ERROR,
-				TRUE
-			);
-			/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
-			$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
-			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
-			$defaultFlashMessageQueue->enqueue($flashMessage);
-		}
-		return $items;
-	}
+	public $borderStyle = NULL;
 
 	/**
-	 * Add selector box items of more exotic kinds.
+	 * An accumulation of messages from the class
 	 *
-	 * @param array $items The array of items (label,value,icon)
-	 * @param array $fieldValue The "columns" array for the field (from TCA)
-	 * @param array $TSconfig TSconfig for the table/row
-	 * @param string $field The fieldname
-	 * @return array The $items array modified.
+	 * @var array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field) {
-		// Values from foreign tables:
-		if ($fieldValue['config']['foreign_table']) {
-			$items = $this->foreignTable($items, $fieldValue, $TSconfig, $field);
-			if ($fieldValue['config']['neg_foreign_table']) {
-				$items = $this->foreignTable($items, $fieldValue, $TSconfig, $field, 1);
-			}
-		}
-		// Values from a file folder:
-		if ($fieldValue['config']['fileFolder']) {
-			$fileFolder = GeneralUtility::getFileAbsFileName($fieldValue['config']['fileFolder']);
-			if (@is_dir($fileFolder)) {
-				// Configurations:
-				$extList = $fieldValue['config']['fileFolder_extList'];
-				$recursivityLevels = isset($fieldValue['config']['fileFolder_recursions'])
-					? MathUtility::forceIntegerInRange($fieldValue['config']['fileFolder_recursions'], 0, 99)
-					: 99;
-				// Get files:
-				$fileFolder = rtrim($fileFolder, '/') . '/';
-				$fileArr = GeneralUtility::getAllFilesAndFoldersInPath(array(), $fileFolder, $extList, 0, $recursivityLevels);
-				$fileArr = GeneralUtility::removePrefixPathFromList($fileArr, $fileFolder);
-				foreach ($fileArr as $fileRef) {
-					$fI = pathinfo($fileRef);
-					$icon = GeneralUtility::inList('gif,png,jpeg,jpg', strtolower($fI['extension']))
-						? '../' . PathUtility::stripPathSitePrefix($fileFolder) . $fileRef
-						: '';
-					$items[] = array(
-						$fileRef,
-						$fileRef,
-						$icon
-					);
-				}
-			}
-		}
-		// If 'special' is configured:
-		if ($fieldValue['config']['special']) {
-			$languageService = $this->getLanguageService();
-			switch ($fieldValue['config']['special']) {
-				case 'tables':
-					foreach ($GLOBALS['TCA'] as $theTableNames => $_) {
-						if (!$GLOBALS['TCA'][$theTableNames]['ctrl']['adminOnly']) {
-							// Icon:
-							$icon = IconUtility::mapRecordTypeToSpriteIconName($theTableNames, array());
-							// Add help text
-							$helpText = array();
-							$languageService->loadSingleTableDescription($theTableNames);
-							$helpTextArray = $GLOBALS['TCA_DESCR'][$theTableNames]['columns'][''];
-							if (!empty($helpTextArray['description'])) {
-								$helpText['description'] = $helpTextArray['description'];
-							}
-							// Item configuration:
-							$items[] = array(
-								$languageService->sL($GLOBALS['TCA'][$theTableNames]['ctrl']['title']),
-								$theTableNames,
-								$icon,
-								$helpText
-							);
-						}
-					}
-					break;
-				case 'pagetypes':
-					$theTypes = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
-					foreach ($theTypes as $theTypeArrays) {
-						// Icon:
-						$icon = 'empty-emtpy';
-						if ($theTypeArrays[1] != '--div--') {
-							$icon = IconUtility::mapRecordTypeToSpriteIconName('pages', array('doktype' => $theTypeArrays[1]));
-						}
-						// Item configuration:
-						$items[] = array(
-							$languageService->sL($theTypeArrays[0]),
-							$theTypeArrays[1],
-							$icon
-						);
-					}
-					break;
-				case 'exclude':
-					$theTypes = BackendUtility::getExcludeFields();
-					foreach ($theTypes as $theTypeArrays) {
-						list($theTable, $theFullField) = explode(':', $theTypeArrays[1]);
-						// If the field comes from a FlexForm, the syntax is more complex
-						$theFieldParts = explode(';', $theFullField);
-						$theField = array_pop($theFieldParts);
-						// Add header if not yet set for table:
-						if (!array_key_exists($theTable, $items)) {
-							$icon = IconUtility::mapRecordTypeToSpriteIconName($theTable, array());
-							$items[$theTable] = array(
-								$languageService->sL($GLOBALS['TCA'][$theTable]['ctrl']['title']),
-								'--div--',
-								$icon
-							);
-						}
-						// Add help text
-						$helpText = array();
-						$languageService->loadSingleTableDescription($theTable);
-						$helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theFullField];
-						if (!empty($helpTextArray['description'])) {
-							$helpText['description'] = $helpTextArray['description'];
-						}
-						// Item configuration:
-						$items[] = array(
-							rtrim($languageService->sL($GLOBALS['TCA'][$theTable]['columns'][$theField]['label']), ':') . ' (' . $theField . ')',
-							$theTypeArrays[1],
-							'empty-empty',
-							$helpText
-						);
-					}
-					break;
-				case 'explicitValues':
-					$theTypes = BackendUtility::getExplicitAuthFieldValues();
-					// Icons:
-					$icons = array(
-						'ALLOW' => 'status-status-permission-granted',
-						'DENY' => 'status-status-permission-denied'
-					);
-					// Traverse types:
-					foreach ($theTypes as $tableFieldKey => $theTypeArrays) {
-						if (is_array($theTypeArrays['items'])) {
-							// Add header:
-							$items[] = array(
-								$theTypeArrays['tableFieldLabel'],
-								'--div--'
-							);
-							// Traverse options for this field:
-							foreach ($theTypeArrays['items'] as $itemValue => $itemContent) {
-								// Add item to be selected:
-								$items[] = array(
-									'[' . $itemContent[2] . '] ' . $itemContent[1],
-									$tableFieldKey . ':' . preg_replace('/[:|,]/', '', $itemValue) . ':' . $itemContent[0],
-									$icons[$itemContent[0]]
-								);
-							}
-						}
-					}
-					break;
-				case 'languages':
-					$items = array_merge($items, BackendUtility::getSystemLanguages());
-					break;
-				case 'custom':
-					// Initialize:
-					$customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
-					if (is_array($customOptions)) {
-						foreach ($customOptions as $coKey => $coValue) {
-							if (is_array($coValue['items'])) {
-								// Add header:
-								$items[] = array(
-									$languageService->sL($coValue['header']),
-									'--div--'
-								);
-								// Traverse items:
-								foreach ($coValue['items'] as $itemKey => $itemCfg) {
-									// Icon:
-									if ($itemCfg[1]) {
-										list($icon) = $this->getIcon($itemCfg[1]);
-									} else {
-										$icon = 'empty-empty';
-									}
-									// Add help text
-									$helpText = array();
-									if (!empty($itemCfg[2])) {
-										$helpText['description'] = $languageService->sL($itemCfg[2]);
-									}
-									// Add item to be selected:
-									$items[] = array(
-										$languageService->sL($itemCfg[0]),
-										$coKey . ':' . preg_replace('/[:|,]/', '', $itemKey),
-										$icon,
-										$helpText
-									);
-								}
-							}
-						}
-					}
-					break;
-				case 'modListGroup':
-
-				case 'modListUser':
-					$loadModules = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
-					$loadModules->load($GLOBALS['TBE_MODULES']);
-					$modList = $fieldValue['config']['special'] == 'modListUser' ? $loadModules->modListUser : $loadModules->modListGroup;
-					if (is_array($modList)) {
-						foreach ($modList as $theMod) {
-							// Icon:
-							$icon = $languageService->moduleLabels['tabs_images'][$theMod . '_tab'];
-							if ($icon) {
-								$icon = '../' . PathUtility::stripPathSitePrefix($icon);
-							}
-							// Add help text
-							$helpText = array(
-								'title' => $languageService->moduleLabels['labels'][$theMod . '_tablabel'],
-								'description' => $languageService->moduleLabels['labels'][$theMod . '_tabdescr']
-							);
-							// Item configuration:
-							$items[] = array(
-								$this->addSelectOptionsToItemArray_makeModuleData($theMod),
-								$theMod,
-								$icon,
-								$helpText
-							);
-						}
-					}
-					break;
-			}
-		}
-		// Return the items:
-		return $items;
-	}
+	public $commentMessages = array();
 
 	/**
-	 * Creates value/label pair for a backend module (main and sub)
+	 * Generation of TCEform elements of the type "input"
+	 * This will render a single-line input form field, possibly with various control/validation features
 	 *
-	 * @param string $value The module key
-	 * @return string The rawurlencoded 2-part string to transfer to interface
-	 * @access private
-	 * @see addSelectOptionsToItemArray()
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\InputElement
 	 */
-	public function addSelectOptionsToItemArray_makeModuleData($value) {
-		$label = '';
-		// Add label for main module:
-		$pp = explode('_', $value);
-		if (count($pp) > 1) {
-			$label .= $this->getLanguageService()->moduleLabels['tabs'][($pp[0] . '_tab')] . '>';
-		}
-		// Add modules own label now:
-		$label .= $this->getLanguageService()->moduleLabels['tabs'][$value . '_tab'];
-		return $label;
+	public function getSingleField_typeInput($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\InputElement::class, $this)
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Adds records from a foreign table (for selector boxes)
+	 * Generation of TCEform elements of the type "text"
+	 * This will render a <textarea> OR RTE area form field, possibly with various control/validation features
 	 *
-	 * @param array $items The array of items (label,value,icon)
-	 * @param array $fieldValue The 'columns' array for the field (from TCA)
-	 * @param array $TSconfig TSconfig for the table/row
-	 * @param string $field The fieldname
-	 * @param bool $pFFlag If set, then we are fetching the 'neg_' foreign tables.
-	 * @return array The $items array modified.
-	 * @see addSelectOptionsToItemArray(), BackendUtility::exec_foreign_table_where_query()
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\TextElement
 	 */
-	public function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = FALSE) {
-		$languageService = $this->getLanguageService();
-		// Init:
-		$pF = $pFFlag ? 'neg_' : '';
-		$f_table = $fieldValue['config'][$pF . 'foreign_table'];
-		$uidPre = $pFFlag ? '-' : '';
-		// Exec query:
-		$res = BackendUtility::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
-		// Perform error test
-		$db = $this->getDatabaseConnection();
-		if ($db->sql_error()) {
-			$msg = htmlspecialchars($db->sql_error());
-			$msg .= '<br />' . LF;
-			$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 */
-			$flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
-			/** @var $defaultFlashMessageQueue FlashMessageQueue */
-			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
-			$defaultFlashMessageQueue->enqueue($flashMessage);
-			return array();
-		}
-		// Get label 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']);
-		// Traverse the selected rows to add them:
-		while ($row = $db->sql_fetch_assoc($res)) {
-			BackendUtility::workspaceOL($f_table, $row);
-			if (is_array($row)) {
-				// Prepare the icon if available:
-				if ($iField && $iPath && $row[$iField]) {
-					$iParts = GeneralUtility::trimExplode(',', $row[$iField], TRUE);
-					$icon = '../' . $iPath . '/' . trim($iParts[0]);
-				} elseif (GeneralUtility::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
-					$icon = IconUtility::mapRecordTypeToSpriteIconName($f_table, $row);
-				} else {
-					$icon = '';
-				}
-				// Add the item:
-				$items[] = array(
-					$lPrefix . htmlspecialchars(BackendUtility::getRecordTitle($f_table, $row)),
-					$uidPre . $row['uid'],
-					$icon
-				);
-			}
-		}
-		$db->sql_free_result($res);
-		return $items;
+	public function getSingleField_typeText($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\TextElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
-	/********************************************
-	 *
-	 * Template functions
-	 *
-	 ********************************************/
 	/**
-	 * Sets the design to the backend design.
-	 * Backend
+	 * Generation of TCEform elements of the type "check"
+	 * This will render a check-box OR an array of checkboxes
 	 *
-	 * @return void
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\CheckboxElement
 	 */
-	public function setNewBEDesign() {
-		$template = GeneralUtility::getUrl(PATH_typo3 . $this->templateFile);
-		// Wrapping all table rows for a particular record being edited:
-		$this->totalWrap = HtmlParser::getSubpart($template, '###TOTALWRAP###');
-		// Wrapping a single field:
-		$this->fieldTemplate = HtmlParser::getSubpart($template, '###FIELDTEMPLATE###');
-		$this->paletteFieldTemplate = HtmlParser::getSubpart($template, '###PALETTEFIELDTEMPLATE###');
-		$this->palFieldTemplate = HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE###');
-		$this->palFieldTemplateHeader = HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE_HEADER###');
+	public function getSingleField_typeCheck($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\CheckboxElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * This inserts the content of $inArr into the field-template
+	 * Generation of TCEform elements of the type "radio"
+	 * This will render a series of radio buttons.
 	 *
-	 * @param array $inArr Array with key/value pairs to insert in the template.
-	 * @param string $altTemplate Alternative template to use instead of the default.
-	 * @return string
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\RadioElement
 	 */
-	public function intoTemplate($inArr, $altTemplate = '') {
-		// Put into template_
-		$fieldTemplateParts = explode('###FIELD_', $altTemplate ?: $this->fieldTemplate);
-		$out = current($fieldTemplateParts);
-		foreach ($fieldTemplateParts as $part) {
-			list($key, $val) = explode('###', $part, 2);
-			$out .= $inArr[$key];
-			$out .= $val;
-		}
-		return $out;
+	public function getSingleField_typeRadio($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\RadioElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Overwrite this function in own extended class to add own markers for output
+	 * Generation of TCEform elements of the type "select"
+	 * This will render a selector box element, or possibly a special construction with two selector boxes.
+	 * That depends on configuration.
 	 *
-	 * @param array $marker Array with key/value pairs to insert in the template.
 	 * @param string $table The table name of the record
 	 * @param string $field The field name which this element is supposed to edit
 	 * @param array $row The record data array where the value(s) for the field can be found
 	 * @param array $PA An array with additional configuration options.
-	 * @return array Marker array for template output
-	 * @see function intoTemplate()
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\SelectElement
 	 */
-	public function addUserTemplateMarkers($marker, $table, $field, $row, &$PA) {
+	public function getSingleField_typeSelect($table, $field, $row, &$PA) {
 		GeneralUtility::logDeprecatedFunction();
-		return $marker;
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\SelectElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Wraps all the table rows into a single table.
-	 * Used externally from scripts like alt_doc.php and db_layout.php (which uses TCEforms...)
+	 * Generation of TCEform elements of the type "group"
+	 * This will render a selectorbox into which elements from either the file system or database can be inserted. Relations.
 	 *
-	 * @param string $c Code to output between table-parts; table rows
-	 * @param array $rec The record
-	 * @param string $table The table name
-	 * @return string
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since 7.0 - will be removed two versions later; Use \TYPO3\CMS\Backend\Form\Element\GroupElement
 	 */
-	public function wrapTotal($c, $rec, $table) {
-		$parts = $this->replaceTableWrap(explode('|', $this->totalWrap, 2), $rec, $table);
-		return $parts[0] . $c . $parts[1] . implode('', $this->hiddenFieldAccum);
+	public function getSingleField_typeGroup($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\GroupElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Generates a token and returns an input field with it
+	 * Generation of TCEform elements of the type "none"
+	 * This will render a non-editable display of the content of the field.
 	 *
-	 * @param string $formName Context of the token
-	 * @param string $tokenName The name of the token GET/POST variable
-	 * @return string A complete input field
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\NoneElement
 	 */
-	static public function getHiddenTokenField($formName = 'securityToken', $tokenName = 'formToken') {
-		$formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
-		return '<input type="hidden" name="' . $tokenName . '" value="' . $formprotection->generateToken($formName) . '" />';
+	public function getSingleField_typeNone($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(NoneElement::class, $this)
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * This replaces markers in the total wrap
+	 * HTML rendering of a value which is not editable.
 	 *
-	 * @param array $arr An array of template parts containing some markers.
-	 * @param array $rec The record
-	 * @param string $table The table name
-	 * @return string
+	 * @param array $config Configuration for the display
+	 * @param string $itemValue The value to display
+	 * @return string The HTML code for the display
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\NoneElement
 	 */
-	public function replaceTableWrap($arr, $rec, $table) {
-		$icon = IconUtility::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec)));
-		// Make "new"-label
-		$languageService = $this->getLanguageService();
-		if (strstr($rec['uid'], 'NEW')) {
-			$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 = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
-			if ($table === 'pages') {
-				$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewPage', TRUE);
-				$pageTitle = sprintf($label, $tableTitle);
-			} else {
-				$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecord', TRUE);
-				if ($rec['pid'] == 0) {
-					$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecordRootLevel', TRUE);
-				}
-				$pageTitle = sprintf($label, $tableTitle, $pageTitle);
-			}
-		} else {
-			$newLabel = ' <span class="typo3-TCEforms-recUid">[' . $rec['uid'] . ']</span>';
-			$rLabel = BackendUtility::getRecordTitle($table, $rec, TRUE, FALSE);
-			$prec = BackendUtility::getRecordWSOL('pages', $rec['pid'], 'uid,title');
-			// Fetch translated title of the table
-			$tableTitle = $languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
-			if ($table === 'pages') {
-				$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 = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecord', TRUE);
-				$pageTitle = BackendUtility::getRecordTitle('pages', $prec, TRUE, FALSE);
-				if ($rLabel === BackendUtility::getNoRecordTitle(TRUE)) {
-					$label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordNoTitle', TRUE);
-				}
-				if ($rec['pid'] == 0) {
-					$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.
-					$pageTitle = sprintf($label, $tableTitle, $rLabel, $pageTitle);
-				} else {
-					// Leave out the record title since it is not set.
-					$pageTitle = sprintf($label, $tableTitle, $pageTitle);
-				}
-			}
-			$icon = $this->getClickMenu($icon, $table, $rec['uid']);
-		}
-		foreach ($arr as $k => $v) {
-			// Make substitutions:
-			$arr[$k] = str_replace(
-				array(
-					'###PAGE_TITLE###',
-					'###ID_NEW_INDICATOR###',
-					'###RECORD_LABEL###',
-					'###TABLE_TITLE###',
-					'###RECORD_ICON###'
-				),
-				array(
-					$pageTitle,
-					$newLabel,
-					$rLabel,
-					htmlspecialchars($languageService->sL($GLOBALS['TCA'][$table]['ctrl']['title'])),
-					$icon
-				),
-				$arr[$k]
-			);
-		}
-		return $arr;
+	public function getSingleField_typeNone_render($config, $itemValue) {
+		GeneralUtility::logDeprecatedFunction();
+		$noneElement = GeneralUtility::makeInstance(NoneElement::class, $this);
+		$elementConfiguration = array(
+			'fieldConf' => array(
+				'config' => $config,
+			),
+			'itemFormElValue' => $itemValue,
+		);
+		return $noneElement->render('', '', '', $elementConfiguration);
 	}
 
 	/**
-	 * Wraps an element in the $out_array with the template row for a "section" ($this->sectionWrap)
+	 * Handler for Flex Forms
 	 *
-	 * @param array $out_array The array with form elements stored in (passed by reference and changed!)
-	 * @param int $out_pointer The pointer to the entry in the $out_array  (passed by reference and incremented!)
-	 * @return void
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, not in use anymore
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\FlexElement
 	 */
-	public function wrapBorder(&$out_array, &$out_pointer) {
+	public function getSingleField_typeFlex($table, $field, $row, &$PA) {
 		GeneralUtility::logDeprecatedFunction();
-		if ($this->sectionWrap && $out_array[$out_pointer]) {
-			$tableAttribs = 'border="0" cellspacing="0" cellpadding="0" width="100%" class="table table-border"';
-			$out_array[$out_pointer] = str_replace('###CONTENT###', $out_array[$out_pointer], str_replace('###TABLE_ATTRIBS###', $tableAttribs, $this->sectionWrap));
-			$out_pointer++;
-		}
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\FlexElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Replaces colorscheme markers in the template string
+	 * Creates the language menu for FlexForms:
 	 *
-	 * @param string $inTemplate Template string with markers to be substituted.
-	 * @return string
+	 * @param array $languages
+	 * @param string $elName
+	 * @param array $selectedLanguage
+	 * @param bool $multi
+	 * @return string HTML for menu
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function rplColorScheme($inTemplate) {
+	public function getSingleField_typeFlex_langMenu($languages, $elName, $selectedLanguage, $multi = TRUE) {
 		GeneralUtility::logDeprecatedFunction();
-		return str_replace(
-			array(
-				// Colors:
-				'###BGCOLOR###',
-				'###BGCOLOR_HEAD###',
-				'###FONTCOLOR_HEAD###',
-				// Classes:
-				'###CLASSATTR_1###',
-				'###CLASSATTR_2###',
-				'###CLASSATTR_4###'
-			),
-			array(
-				// Colors:
-				$this->colorScheme[0] ? ' bgcolor="' . $this->colorScheme[0] . '"' : '',
-				$this->colorScheme[1] ? ' bgcolor="' . $this->colorScheme[1] . '"' : '',
-				$this->colorScheme[3],
-				// Classes:
-				$this->classScheme[0] ? ' class="' . $this->classScheme[0] . '"' : '',
-				$this->classScheme[1] ? ' class="' . $this->classScheme[1] . '"' : '',
-				$this->classScheme[3] ? ' class="' . $this->classScheme[3] . '"' : ''
-			),
-			$inTemplate
-		);
+		$opt = array();
+		foreach ($languages as $lArr) {
+			$opt[] = '<option value="' . htmlspecialchars($lArr['ISOcode']) . '"'
+				. (in_array($lArr['ISOcode'], $selectedLanguage) ? ' selected="selected"' : '') . '>'
+				. htmlspecialchars($lArr['title']) . '</option>';
+		}
+		$output = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE))
+			. ' class="tceforms-select tceforms-multiselect tceforms-flexlangmenu" name="' . $elName . '[]"'
+			. ($multi ? ' multiple="multiple" size="' . count($languages) . '"' : '') . '>' . implode('', $opt)
+			. '</select>';
+		return $output;
 	}
 
 	/**
-	 * Returns divider.
-	 * Currently not implemented and returns only blank value.
+	 * Creates the menu for selection of the sheets:
 	 *
-	 * @return string Empty string
+	 * @param array $sArr Sheet array for which to render the menu
+	 * @param string $elName Form element name of the field containing the sheet pointer
+	 * @param string $sheetKey Current sheet key
+	 * @return string HTML for menu
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getDivider() {
+	public function getSingleField_typeFlex_sheetMenu($sArr, $elName, $sheetKey) {
 		GeneralUtility::logDeprecatedFunction();
-		return '';
+		$tCells = array();
+		$pct = round(100 / count($sArr));
+		foreach ($sArr as $sKey => $sheetCfg) {
+			if ($this->getBackendUserAuthentication()->jsConfirmation(1)) {
+				$onClick = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){'
+					. 'document.editform[\'' . $elName . '\'].value=\'' . $sKey . '\'; TBE_EDITOR.submitForm()};';
+			} else {
+				$onClick = 'if(TBE_EDITOR.checkSubmit(-1)){ document.editform[\'' . $elName . '\'].value=\'' . $sKey . '\'; TBE_EDITOR.submitForm();}';
+			}
+			$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->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>';
 	}
 
 	/**
-	 * Creates HTML output for a palette
+	 * Handler for unknown types.
 	 *
-	 * @param array $palArr The palette array to print
-	 * @return string HTML output
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\UnknownElement
 	 */
-	public function printPalette($palArr) {
-
-		// GROUP FIELDS
-		$groupedFields = array();
-		$row = 0;
-		$lastLineWasLinebreak = TRUE;
-		foreach ($palArr as $field){
-			if ($field['NAME'] === '--linebreak--') {
-				if (!$lastLineWasLinebreak) {
-					$row++;
-					$groupedFields[$row][] = $field;
-					$row++;
-					$lastLineWasLinebreak = TRUE;
-				}
-			} else {
-				$lastLineWasLinebreak = FALSE;
-				$groupedFields[$row][] = $field;
-			}
-		}
-
-		$out = '';
-		// PROCESS FIELDS
-		foreach ($groupedFields as $fields) {
-
-			$numberOfItems = count($fields);
-			$cols = $numberOfItems;
-			$colWidth = (int)floor(12 / $cols);
-
-			// COLS
-			$colClass = "col-md-12";
-			$colClear = array();
-			if ($colWidth == 6) {
-				$colClass = "col-sm-6";
-				$colClear = array(
-					2 => 'visible-sm-block visible-md-block visible-lg-block',
-				);
-			} elseif ($colWidth === 4) {
-				$colClass = "col-sm-4";
-				$colClear = array(
-					3 => 'visible-sm-block visible-md-block visible-lg-block',
-				);
-			} elseif ($colWidth === 3) {
-				$colClass = "col-sm-6 col-md-3";
-				$colClear = array(
-					2 => 'visible-sm-block',
-					4 => 'visible-md-block visible-lg-block',
-				);
-			} elseif ($colWidth <= 2) {
-				$colClass = "checkbox-column col-sm-6 col-md-3 col-lg-2";
-				$colClear = array(
-					2 => 'visible-sm-block',
-					4 => 'visible-md-block',
-					6 => 'visible-lg-block'
-				);
-			}
-
-			// RENDER FIELDS
-			for ($counter = 0; $counter < $numberOfItems; $counter++) {
-				$content = $fields[$counter];
-				if ($content['NAME'] === '--linebreak--') {
-					if ($counter !== $numberOfItems) {
-						$out .= '<div class="clearfix"></div>';
-					}
-				} else {
-
-					// ITEM
-					$out .= '
-						<!-- printPalette -->
-						<div class="form-group t3js-formengine-palette-field ' . $colClass . '">
-							<label class="t3js-formengine-label">
-								' . $content['NAME'] . '
-								<img name="req_' . $content['TABLE'] . '_' . $content['ID'] . '_' . $content['FIELD'] . '" src="clear.gif" class="t3js-formengine-field-required" alt="" />
-							</label>
-							' . $content['ITEM_NULLVALUE'] . '
-							<div class="t3js-formengine-field-item ' . $content['ITEM_DISABLED'] . '">
-								<div class="t3-form-field-disable"></div>
-								' . $content['ITEM'] . '
-							</div>
-						</div>';
+	public function getSingleField_typeUnknown($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\UnknownElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
+	}
 
-					// BREAKPOINTS
-					if ($counter + 1 < $numberOfItems && !empty($colClear)) {
-						foreach ($colClear as $rowBreakAfter => $clearClass) {
-							if (($counter + 1) % $rowBreakAfter === 0) {
-								$out .= '<div class="clearfix '. $clearClass . '"></div>';
-							}
-						}
-					}
-				}
-			}
-		}
-		return $out;
+	/**
+	 * User defined field type
+	 *
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return string The HTML code for the TCEform field
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use \TYPO3\CMS\Backend\Form\Element\UserElement
+	 */
+	public function getSingleField_typeUser($table, $field, $row, &$PA) {
+		GeneralUtility::logDeprecatedFunction();
+		return $item = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\Element\UserElement::class, $this)
+			->setGlobalOptions($this->getConfigurationOptionsForChildElements())
+			->render($table, $field, $row, $PA);
 	}
 
 	/**
-	 * Setting the current color scheme ($this->colorScheme) based on $this->defColorScheme plus input string.
+	 * Overrides the TCA field configuration by TSconfig settings.
 	 *
-	 * @param string $scheme A color scheme string.
-	 * @return void
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * Example TSconfig: TCEform.<table>.<field>.config.appearance.useSortable = 1
+	 * This overrides the setting in $GLOBALS['TCA'][<table>]['columns'][<field>]['config']['appearance']['useSortable'].
+	 *
+	 * @param array $fieldConfig $GLOBALS['TCA'] field configuration
+	 * @param array $TSconfig TSconfig
+	 * @return array Changed TCA field configuration
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8.
 	 */
-	public function setColorScheme($scheme) {
+	public function overrideFieldConf($fieldConfig, $TSconfig) {
 		GeneralUtility::logDeprecatedFunction();
-		$this->colorScheme = $this->defColorScheme;
-		$this->classScheme = $this->defClassScheme;
-		$parts = GeneralUtility::trimExplode(',', $scheme);
-		foreach ($parts as $key => $col) {
-			// Split for color|class:
-			list($color, $class) = GeneralUtility::trimExplode('|', $col);
-			// Handle color values:
-			if ($color) {
-				$this->colorScheme[$key] = $color;
-			}
-			if ($color == '-') {
-				$this->colorScheme[$key] = '';
-			}
-			// Handle class values:
-			if ($class) {
-				$this->classScheme[$key] = $class;
-			}
-			if ($class == '-') {
-				$this->classScheme[$key] = '';
-			}
-		}
+		return FormEngineUtility::overrideFieldConf($fieldConfig, $TSconfig);
 	}
 
 	/**
-	 * Reset color schemes.
+	 * Extracting values from a value/label list (as made by transferData class)
 	 *
-	 * @return void
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param array $itemFormElValue Values in an array
+	 * @return array Input string exploded with comma and for each value only the label part is set in the array. Keys are numeric
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8.
 	 */
-	public function resetSchemes() {
+	public function extractValuesOnlyFromValueLabelList($itemFormElValue) {
 		GeneralUtility::logDeprecatedFunction();
-		$this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][0]);
-		$this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
-		$this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0];
+		return FormEngineUtility::extractValuesOnlyFromValueLabelList($itemFormElValue);
 	}
 
 	/**
-	 * Store current color scheme
+	 * Initializes language icons etc.
 	 *
-	 * @return void
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param string $table Table name
+	 * @param array $row Record
+	 * @param string $sys_language_uid Sys language uid OR ISO language code prefixed with "v", eg. "vDA
+	 * @return string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8.
 	 */
-	public function storeSchemes() {
+	public function getLanguageIcon($table, $row, $sys_language_uid) {
 		GeneralUtility::logDeprecatedFunction();
-		$this->savedSchemes['classScheme'] = $this->classScheme;
-		$this->savedSchemes['colorScheme'] = $this->colorScheme;
-		$this->savedSchemes['fieldStyle'] = $this->fieldStyle;
-		$this->savedSchemes['borderStyle'] = $this->borderStyle;
+		return FormEngineUtility::getLanguageIcon($table, $row, $sys_language_uid);
 	}
 
 	/**
-	 * Restore the saved color scheme
+	 * Format field content of various types if $config['format'] is set to date, filesize, ..., user
+	 * This is primarily for the field type none but can be used for user field types for example
 	 *
-	 * @return void
-	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 * @param array $config Configuration for the display
+	 * @param string $itemValue The value to display
+	 * @return string Formatted Field content
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. This is now encapsulated within NoneElement
 	 */
-	public function restoreSchemes() {
+	public function formatValue($config, $itemValue) {
 		GeneralUtility::logDeprecatedFunction();
-		$this->classScheme = $this->savedSchemes['classScheme'];
-		$this->colorScheme = $this->savedSchemes['colorScheme'];
-		$this->fieldStyle = $this->savedSchemes['fieldStyle'];
-		$this->borderStyle = $this->savedSchemes['borderStyle'];
+		$format = trim($config['format']);
+		switch ($format) {
+			case 'date':
+				if ($itemValue) {
+					$option = trim($config['format.']['option']);
+					if ($option) {
+						if ($config['format.']['strftime']) {
+							$value = strftime($option, $itemValue);
+						} else {
+							$value = date($option, $itemValue);
+						}
+					} else {
+						$value = date('d-m-Y', $itemValue);
+					}
+				} else {
+					$value = '';
+				}
+				if ($config['format.']['appendAge']) {
+					$age = BackendUtility::calcAge(
+						$GLOBALS['EXEC_TIME'] - $itemValue,
+						$this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
+					);
+					$value .= ' (' . $age . ')';
+				}
+				$itemValue = $value;
+				break;
+			case 'datetime':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i d-m-Y', (int)$itemValue);
+				}
+				break;
+			case 'time':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i', (int)$itemValue);
+				}
+				break;
+			case 'timesec':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('H:i:s', (int)$itemValue);
+				}
+				break;
+			case 'year':
+				// compatibility with "eval" (type "input")
+				if ($itemValue !== '') {
+					$itemValue = date('Y', (int)$itemValue);
+				}
+				break;
+			case 'int':
+				$baseArr = array('dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b');
+				$base = trim($config['format.']['base']);
+				$format = $baseArr[$base] ?: 'd';
+				$itemValue = sprintf('%' . $format, $itemValue);
+				break;
+			case 'float':
+				$precision = MathUtility::forceIntegerInRange($config['format.']['precision'], 1, 10, 2);
+				$itemValue = sprintf('%.' . $precision . 'f', $itemValue);
+				break;
+			case 'number':
+				$format = trim($config['format.']['option']);
+				$itemValue = sprintf('%' . $format, $itemValue);
+				break;
+			case 'md5':
+				$itemValue = md5($itemValue);
+				break;
+			case 'filesize':
+				// We need to cast to int here, otherwise empty values result in empty output,
+				// but we expect zero.
+				$value = GeneralUtility::formatSize((int)$itemValue);
+				if ($config['format.']['appendByteSize']) {
+					$value .= ' (' . $itemValue . ')';
+				}
+				$itemValue = $value;
+				break;
+			case 'user':
+				$func = trim($config['format.']['userFunc']);
+				if ($func) {
+					$params = array(
+						'value' => $itemValue,
+						'args' => $config['format.']['userFunc'],
+						'config' => $config,
+						'pObj' => &$this
+					);
+					$itemValue = GeneralUtility::callUserFunction($func, $params, $this);
+				}
+				break;
+			default:
+				// Do nothing e.g. when $format === ''
+		}
+		return $itemValue;
 	}
 
-	/********************************************
-	 *
-	 * JavaScript related functions
-	 *
-	 ********************************************/
 	/**
-	 * JavaScript code added BEFORE the form is drawn:
+	 * Wraps the icon of a relation item (database record or file) in a link opening the context menu for the item.
 	 *
-	 * @return string A <script></script> section with JavaScript.
+	 * @param string $str The icon HTML to wrap
+	 * @param string $table Table name (eg. "pages" or "tt_content") OR the absolute path to the file
+	 * @param int $uid The uid of the record OR if file, just blank value.
+	 * @return string HTML
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function JStop() {
-		$out = '';
-		// Additional top HTML:
-		if (count($this->additionalCode_pre)) {
-			$out .= implode('
-
-				<!-- NEXT: -->
-			', $this->additionalCode_pre);
-		}
-		// Additional top JavaScript
-		if (count($this->additionalJS_pre)) {
-			$out .= '
-
-
-		<!--
-			JavaScript in top of page (before form):
-		-->
-
-		<script type="text/javascript">
-			/*<![CDATA[*/
-
-			' . implode('
-
-					// NEXT:
-			', $this->additionalJS_pre) . '
-
-			/*]]>*/
-		</script>
-			';
-		}
-		// Return result:
-		return $out;
+	public function getClickMenu($str, $table, $uid = 0) {
+		GeneralUtility::logDeprecatedFunction();
+		return $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($str, $table, $uid, 1, '', '+copy,info,edit,view');
 	}
 
 	/**
-	 * JavaScript code used for input-field evaluation.
-	 *
-	 * Example use:
-	 *
-	 * $msg .= 'Distribution time (hh:mm dd-mm-yy):<br /><input type="text" name="send_mail_datetime_hr"'
-	 *         . ' onchange="typo3form.fieldGet(\'send_mail_datetime\', \'datetime\', \'\', 0,0);"'
-	 *         . $this->getTBE()->formWidth(20) . ' /><input type="hidden" value="' . $GLOBALS['EXEC_TIME']
-	 *         . '" name="send_mail_datetime" /><br />';
-	 * $this->extJSCODE .= 'typo3form.fieldSet("send_mail_datetime", "datetime", "", 0,0);';
-	 *
-	 * ... and then include the result of this function after the form
+	 * Returns the "special" configuration (from the "types" "showitem" list) for a fieldname based on input table/record
+	 * (Not used anywhere...?)
 	 *
-	 * @param string $formname The identification of the form on the page.
-	 * @param bool $update Just extend/update existing settings, e.g. for AJAX call
-	 * @return string A section with JavaScript - if $update is FALSE, embedded in <script></script>
+	 * @param string $table The table name
+	 * @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
+	 * @param string $field Specify the field name.
+	 * @return array|NULL
+	 * @see getSpecConfFromString(), BackendUtility::getTCAtypes()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function JSbottom($formname = 'forms[0]', $update = FALSE) {
-		$languageService = $this->getLanguageService();
-		$jsFile = array();
-		$elements = array();
-		$out = '';
-		// Required:
-		foreach ($this->requiredFields as $itemImgName => $itemName) {
-			$match = array();
-			if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
-				$record = $match[1];
-				$field = $match[2];
-				$elements[$record][$field]['required'] = 1;
-				$elements[$record][$field]['requiredImg'] = $itemImgName;
-				if (isset($this->requiredAdditional[$itemName]) && is_array($this->requiredAdditional[$itemName])) {
-					$elements[$record][$field]['additional'] = $this->requiredAdditional[$itemName];
-				}
-			}
-		}
-		// Range:
-		foreach ($this->requiredElements as $itemName => $range) {
-			if (preg_match('/^(.+)\\[((\\w|\\d|_)+)\\]$/', $itemName, $match)) {
-				$record = $match[1];
-				$field = $match[2];
-				$elements[$record][$field]['range'] = array($range[0], $range[1]);
-				$elements[$record][$field]['rangeImg'] = $range['imgName'];
-			}
-		}
-		$this->TBE_EDITOR_fieldChanged_func = 'TBE_EDITOR.fieldChanged_fName(fName,formObj[fName+"_list"]);';
-		if (!$update) {
-			if ($this->loadMD5_JS) {
-				$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
-			}
-			$pageRenderer = $this->getPageRenderer();
-			// load the main module for FormEngine with all important JS functions
-			$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FormEngine');
-			$pageRenderer->loadPrototype();
-			$pageRenderer->loadJquery();
-			$pageRenderer->loadExtJS();
-			$beUserAuth = $this->getBackendUserAuthentication();
-			// Make textareas resizable and flexible ("autogrow" in height)
-			$textareaSettings = array(
-				'autosize'  => (bool)$beUserAuth->uc['resizeTextareas_Flexible']
-			);
-			$pageRenderer->addInlineSettingArray('Textarea', $textareaSettings);
-
-			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js');
-			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
-			// Needed for FormEngine manipulation (date picker)
-			$dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY'));
-			$pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
-
-			// support placeholders for IE9 and lower
-			if ($this->clientInfo['BROWSER'] == 'msie' && $this->clientInfo['VERSION'] <= 9) {
-				$this->loadJavascriptLib('contrib/placeholdersjs/placeholders.jquery.min.js');
-			}
-
-			$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tceforms.js');
-			// If IRRE fields were processed, add the JavaScript functions:
-			if ($this->inline->inlineCount) {
-				$pageRenderer->loadScriptaculous();
-				// We want to load jQuery-ui inside our js. Enable this using requirejs.
-				$pageRenderer->loadRequireJs();
-				$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js');
-				$out .= '
-				inline.setPrependFormFieldNames("' . $this->inline->prependNaming . '");
-				inline.setNoTitleString("' . addslashes(BackendUtility::getNoRecordTitle(TRUE)) . '");
-				';
-				// Always include JS functions for Suggest fields as we don't know what will come
-				$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
-			} else {
-				// If Suggest fields were processed, add the JS functions
-				if ($this->suggest->suggestCount > 0) {
-					$pageRenderer->loadScriptaculous();
-					$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
+	public function getSpecConfForField($table, $row, $field) {
+		GeneralUtility::logDeprecatedFunction();
+		// Finds the current "types" configuration for the table/row:
+		$types_fieldConfig = BackendUtility::getTCAtypes($table, $row);
+		// If this is an array, then traverse it:
+		if (is_array($types_fieldConfig)) {
+			foreach ($types_fieldConfig as $vconf) {
+				// If the input field name matches one found in the 'types' list, then return the 'special' configuration.
+				if ($vconf['field'] == $field) {
+					return $vconf['spec'];
 				}
 			}
-			$out .= '
-			TBE_EDITOR.images.req.src = "' . IconUtility::skinImg($this->backPath, 'gfx/required_h.gif', '', 1) . '";
-			TBE_EDITOR.images.sel.src = "' . IconUtility::skinImg($this->backPath, 'gfx/content_selected.gif', '', 1) . '";
-			TBE_EDITOR.images.clear.src = "' . $this->backPath . 'clear.gif";
-
-			TBE_EDITOR.formname = "' . $formname . '";
-			TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
-			TBE_EDITOR.backPath = "' . addslashes($this->backPath) . '";
-			TBE_EDITOR.prependFormFieldNames = "' . $this->prependFormFieldNames . '";
-			TBE_EDITOR.prependFormFieldNamesUENC = "' . rawurlencode($this->prependFormFieldNames) . '";
-			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($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.maxItemsAllowed = ' . GeneralUtility::quoteJSvalue($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.maxItemsAllowed')) . ';
-			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'] . '";
-
-			TBE_EDITOR.customEvalFunctions = {};
-
-			';
-		}
-		// Add JS required for inline fields
-		if (count($this->inline->inlineData)) {
-			$out .= '
-			inline.addToDataArray(' . json_encode($this->inline->inlineData) . ');
-			';
-		}
-		// Registered nested elements for tabs or inline levels:
-		if (count($this->requiredNested)) {
-			$out .= '
-			TBE_EDITOR.addNested(' . json_encode($this->requiredNested) . ');
-			';
 		}
-		// Elements which are required or have a range definition:
-		if (count($elements)) {
-			$out .= '
-			TBE_EDITOR.addElements(' . json_encode($elements) . ');
-			TBE_EDITOR.initRequired();
-			';
-		}
-		// $this->additionalJS_submit:
-		if ($this->additionalJS_submit) {
-			$additionalJS_submit = implode('', $this->additionalJS_submit);
-			$additionalJS_submit = str_replace(array(CR, LF), '', $additionalJS_submit);
-			$out .= '
-			TBE_EDITOR.addActionChecks("submit", "' . addslashes($additionalJS_submit) . '");
-			';
-		}
-		$out .= LF . implode(LF, $this->additionalJS_post) . LF . $this->extJSCODE;
-		// Regular direct output:
-		if (!$update) {
-			$spacer = LF . TAB;
-			$out = $spacer . implode($spacer, $jsFile) . GeneralUtility::wrapJS($out);
-		}
-		return $out;
+		return NULL;
 	}
 
 	/**
-	 * Prints necessary JavaScript for TCEforms (after the form HTML).
-	 * currently this is used to transform page-specific options in the TYPO3.Settings array for JS
-	 * so the JS module can access these values
+	 * Returns the "special" configuration of an "extra" string (non-parsed)
 	 *
-	 * @return string
+	 * @param string $extraString The "Part 4" of the fields configuration in "types" "showitem" lists.
+	 * @param string $defaultExtras The ['defaultExtras'] value from field configuration
+	 * @return array An array with the special options in.
+	 * @see getSpecConfForField(), BackendUtility::getSpecConfParts()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function printNeededJSFunctions() {
-		/** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-		$pageRenderer = $this->getControllerDocumentTemplate()->getPageRenderer();
-
-		// set variables to be accessible for JS
-		$pageRenderer->addInlineSetting('FormEngine', 'formName', $this->formName);
-		$pageRenderer->addInlineSetting('FormEngine', 'backPath', $this->backPath);
+	public function getSpecConfFromString($extraString, $defaultExtras) {
+		GeneralUtility::logDeprecatedFunction();
+		return BackendUtility::getSpecConfParts($extraString, $defaultExtras);
+	}
 
-		// Integrate JS functions for the element browser if such fields or IRRE fields were processed
-		if ($this->printNeededJS['dbFileIcons'] || $this->inline->inlineCount > 0 || $this->suggest->suggestCount > 0) {
-			$pageRenderer->addInlineSetting('FormEngine', 'legacyFieldChangedCb', 'function() { ' . $this->TBE_EDITOR_fieldChanged_func . ' };');
+	/**
+	 * 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.
+	 * @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'])
+			&& (string)$vArray[$vDEFkey . '.vDEFbase'] !== (string)$vArray['vDEF']
+		) {
+			// Create diff-result:
+			$t3lib_diff_Obj = GeneralUtility::makeInstance(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;
+	}
 
-		return $this->JSbottom($this->formName);
+	/**
+	 * Creates style attribute content for option tags in a selector box, primarily setting
+	 * it up to show the icon of an element as background image (works in mozilla)
+	 *
+	 * @param string $iconString Icon string for option item
+	 * @return string Style attribute content, if any
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function optionTagStyle($iconString) {
+		GeneralUtility::logDeprecatedFunction();
+		return FormEngineUtility::optionTagStyle($iconString);
 	}
 
 	/**
-	 * Returns necessary JavaScript for the top
+	 * Get icon (for example for selector boxes)
 	 *
-	 * @return string
+	 * @param string $icon Icon reference
+	 * @return array Array with two values; the icon file reference, the icon file information array (getimagesize())
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function printNeededJSFunctions_top() {
-		return $this->JStop($this->formName);
+	public function getIcon($icon) {
+		GeneralUtility::logDeprecatedFunction();
+		return FormEngineUtility::getIcon($icon);
 	}
 
 	/**
-	 * Includes a javascript library that exists in the core /typo3/ directory. The
-	 * backpath is automatically applied.
-	 * This method acts as wrapper for $GLOBALS['SOBE']->doc->loadJavascriptLib($lib).
+	 * Renders the $icon, supports a filename for skinImg or sprite-icon-name
 	 *
-	 * @param string $lib Library name. Call it with the full path like "contrib/prototype/prototype.js" to load it
-	 * @return void
+	 * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
+	 * @param string $alt Alt attribute of the icon returned
+	 * @param string $title Title attribute of the icon return
+	 * @return string A tag representing to show the asked icon
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function loadJavascriptLib($lib) {
-		$this->getControllerDocumentTemplate()->loadJavascriptLib($lib);
+	public function getIconHtml($icon, $alt = '', $title = '') {
+		GeneralUtility::logDeprecatedFunction();
+		return FormEngineUtility::getIconHtml($icon, $alt, $title);
 	}
 
 	/**
-	 * Wrapper for access to the current page renderer object
+	 * Wraps a string with a link to the palette.
 	 *
-	 * @return \TYPO3\CMS\Core\Page\PageRenderer
+	 * @param string $header The string to wrap in an A-tag
+	 * @param string $table The table name for which to open the palette.
+	 * @param array $row The palette pointer.
+	 * @param int $palette The record array
+	 * @param mixed $retFunc Not used
+	 * @return array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getPageRenderer() {
-		return $this->getControllerDocumentTemplate()->getPageRenderer();
+	public function wrapOpenPalette($header, $table, $row, $palette, $retFunc) {
+		GeneralUtility::logDeprecatedFunction();
+		$id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid'];
+		$res = '<a href="#" onclick="TBE_EDITOR.toggle_display_states(\'' . $id . '\',\'block\',\'none\'); return false;" >' . $header . '</a>';
+		return array($res, '');
 	}
 
-	/********************************************
+	/**
+	 * Add the id and the style property to the field palette
 	 *
-	 * Various helper functions
+	 * @param string $code Palette Code
+	 * @param string $table The table name for which to open the palette.
+	 * @param string $row Palette ID
+	 * @param string $palette The record array
+	 * @param bool $collapsed TRUE if collapsed
+	 * @return bool Is collapsed
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function wrapPaletteField($code, $table, $row, $palette, $collapsed) {
+		GeneralUtility::logDeprecatedFunction();
+		$display = $collapsed ? 'none' : 'block';
+		$id = 'TCEFORMS_' . $table . '_' . $palette . '_' . $row['uid'];
+		$code = '<div id="' . $id . '" style="display:' . $display . ';" >' . $code . '</div>';
+		return $code;
+	}
+
+	/**
+	 * Returns element reference for form element name
 	 *
-	 ********************************************/
+	 * @param string $itemName Form element name
+	 * @return string Form element reference (JS)
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function elName($itemName) {
+		GeneralUtility::logDeprecatedFunction();
+		return 'document.editform[\'' . $itemName . '\']';
+	}
+
 	/**
-	 * Gets default record. Maybe not used anymore. FE-editor?
+	 * Returns the max-width in pixels for a <input>/<textarea>-element
 	 *
-	 * @param string $table Database Tablename
-	 * @param int $pid PID value (positive / negative)
-	 * @return array|NULL "default" row.
+	 * @param int $size The abstract size value (1-48)
+	 * @return int max-width in pixels
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getDefaultRecord($table, $pid = 0) {
+	public function formMaxWidth($size = 48) {
 		GeneralUtility::logDeprecatedFunction();
-		if ($GLOBALS['TCA'][$table]) {
-			$row = array();
-			if ($pid < 0 && $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
-				// Fetches the previous record:
-				$db = $this->getDatabaseConnection();
-				$res = $db->exec_SELECTquery('*', $table, 'uid=' . abs($pid) . BackendUtility::deleteClause($table));
-				if ($drow = $db->sql_fetch_assoc($res)) {
-					// Gets the list of fields to copy from the previous record.
-					$fArr = explode(',', $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']);
-					foreach ($fArr as $theF) {
-						if ($GLOBALS['TCA'][$table]['columns'][$theF]) {
-							$row[$theF] = $drow[$theF];
-						}
-					}
-				}
-				$db->sql_free_result($res);
-			}
-			foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $info) {
-				if (isset($info['config']['default'])) {
-					$row[$field] = $info['config']['default'];
-				}
-			}
-			return $row;
+		$size = round($size * $this->form_largeComp);
+		$width = ceil($size * $this->form_rowsToStylewidth);
+		return $width;
+	}
+
+	/**
+	 * Returns parameters to set the width for a <input>/<textarea>-element
+	 *
+	 * @param int $size The abstract size value (1-48)
+	 * @param bool $textarea If this is for a text area.
+	 * @return string Either a "style" attribute string or "cols"/"size" attribute string.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function formWidth($size = 48, $textarea = FALSE) {
+		GeneralUtility::logDeprecatedFunction();
+		$fieldWidthAndStyle = $this->formWidthAsArray($size, $textarea);
+		// Setting width by style-attribute. 'cols' MUST be avoided with NN6+
+		$widthAndStyleAttributes = ' style="' . htmlspecialchars($fieldWidthAndStyle['style']) . '"';
+		if ($fieldWidthAndStyle['class']) {
+			$widthAndStyleAttributes .= ' class="' . htmlspecialchars($fieldWidthAndStyle['class']) . '"';
 		}
-		return NULL;
+		return $widthAndStyleAttributes;
+	}
+
+	/**
+	 * Returns parameters to set the width for a <input>/<textarea>-element
+	 *
+	 * @param int $size The abstract size value (1-48)
+	 * @param bool $textarea If set, calculates sizes for a text area.
+	 * @return array An array containing style, class, and width attributes.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function formWidthAsArray($size = 48, $textarea = FALSE) {
+		GeneralUtility::logDeprecatedFunction();
+		$fieldWidthAndStyle = array('style' => '', 'class' => '', 'width' => '');
+		$widthInPixels = $this->formMaxWidth($size);
+		$fieldWidthAndStyle['style'] = 'width: ' . $widthInPixels . 'px; ';
+		$fieldWidthAndStyle['class'] = 'formfield-' . ($textarea ? 'text' : 'input');
+		return $fieldWidthAndStyle;
+	}
+
+	/**
+	 * Get style CSS values for the current field type.
+	 *
+	 * @param string $type Field type (eg. "check", "radio", "select")
+	 * @return string CSS attributes
+	 * @see formElStyleClassValue()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
+	 */
+	public function formElStyle($type) {
+		GeneralUtility::logDeprecatedFunction();
+		return $this->formElStyleClassValue($type);
 	}
 
 	/**
-	 * Returns TRUE if the given $row is new (i.e. has not been saved to the database)
+	 * Get class attribute value for the current field type.
 	 *
-	 * @param string $table
-	 * @param array $row
-	 * @return bool
+	 * @param string $type Field type (eg. "check", "radio", "select")
+	 * @return string CSS attributes
+	 * @see formElStyleClassValue()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function isNewRecord($table, $row) {
-		return !MathUtility::canBeInterpretedAsInteger($row['uid']) && GeneralUtility::isFirstPartOfStr($row['uid'], 'NEW');
+	public function formElClass($type) {
+		GeneralUtility::logDeprecatedFunction();
+		return $this->formElStyleClassValue($type, TRUE);
 	}
 
 	/**
-	 * Return record path (visually formatted, using BackendUtility::getRecordPath() )
+	 * Get style CSS values for the current field type.
 	 *
-	 * @param string $table Table name
-	 * @param array $rec Record array
-	 * @return string The record path.
-	 * @see BackendUtility::getRecordPath()
+	 * @param string $type Field type (eg. "check", "radio", "select")
+	 * @param bool $class If set, will return value only if prefixed with CLASS, otherwise must not be prefixed "CLASS
+	 * @return string CSS attributes
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getRecordPath($table, $rec) {
-		BackendUtility::fixVersioningPid($table, $rec);
-		list($tscPID, $thePidValue) = BackendUtility::getTSCpidCached($table, $rec['uid'], $rec['pid']);
-		if ($thePidValue >= 0) {
-			return BackendUtility::getRecordPath($tscPID, $this->readPerms(), 15);
+	public function formElStyleClassValue($type, $class = FALSE) {
+		GeneralUtility::logDeprecatedFunction();
+		// Get value according to field:
+		if (isset($this->fieldStyle[$type])) {
+			$style = trim($this->fieldStyle[$type]);
+		} else {
+			$style = trim($this->fieldStyle['all']);
 		}
-		return '';
+		// Check class prefixed:
+		if (substr($style, 0, 6) == 'CLASS:') {
+			$out = $class ? trim(substr($style, 6)) : '';
+		} else {
+			$out = !$class ? $style : '';
+		}
+		return $out;
 	}
 
 	/**
-	 * Returns the select-page read-access SQL clause.
-	 * Returns cached string, so you can call this function as much as you like without performance loss.
+	 * Return default "style" / "class" attribute line.
 	 *
-	 * @return string
+	 * @param string $type Field type (eg. "check", "radio", "select")
+	 * @param string $additionalClass Additional class(es) to be added
+	 * @return string CSS attributes
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function readPerms() {
-		if (!$this->perms_clause_set) {
-			$this->perms_clause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
-			$this->perms_clause_set = TRUE;
-		}
-		return $this->perms_clause;
+	public function insertDefStyle($type, $additionalClass = '') {
+		GeneralUtility::logDeprecatedFunction();
+		$cssClasses = trim('t3-formengine-field-' . $type . ' ' . $additionalClass);
+		return 'class="' . htmlspecialchars($cssClasses) . '"';
 	}
 
 	/**
-	 * Fetches language label for key
+	 * Initialize item array (for checkbox, selectorbox, radio buttons)
+	 * Will resolve the label value.
 	 *
-	 * @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.
+	 * @param array $fieldValue The "columns" array for the field (from TCA)
+	 * @return array An array of arrays with three elements; label, value, icon
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function sL($str) {
+	public function initItemArray($fieldValue) {
 		GeneralUtility::logDeprecatedFunction();
-		return $this->getLanguageService()->sL($str);
+		return FormEngineUtility::initItemArray($fieldValue);
 	}
 
 	/**
-	 * Returns language label from locallang_core.xlf
-	 * Labels must be prefixed with either "l_" or "m_".
-	 * The prefix "l_" maps to the prefix "labels." inside locallang_core.xlf
-	 * The prefix "m_" maps to the prefix "mess." inside locallang_core.xlf
+	 * Merges items into an item-array, optionally with an icon
+	 * example:
+	 * TCEFORM.pages.doktype.addItems.13 = My Label
+	 * TCEFORM.pages.doktype.addItems.13.icon = EXT:t3skin/icons/gfx/i/pages.gif
 	 *
-	 * @param string $str The label key
-	 * @return string The value of the label, fetched for the current backend language.
+	 * @param array $items The existing item array
+	 * @param array $iArray An array of items to add. NOTICE: The keys are mapped to values, and the values and mapped to be labels. No possibility of adding an icon.
+	 * @return array The updated $item array
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getLL($str) {
+	public function addItems($items, $iArray) {
 		GeneralUtility::logDeprecatedFunction();
-		$content = '';
-		switch (substr($str, 0, 2)) {
-			case 'l_':
-				$content = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.' . substr($str, 2));
-				break;
-			case 'm_':
-				$content = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.' . substr($str, 2));
-				break;
-		}
-		return $content;
+		return FormEngineUtility::addItems($items, $iArray);
 	}
 
 	/**
-	 * Returns TRUE, if the palette, $palette, is collapsed (not shown, but found in top-frame) for the table.
+	 * Perform user processing of the items arrays of checkboxes, selectorboxes and radio buttons.
 	 *
-	 * @param string $table The table name
-	 * @param int $palette The palette pointer/number
-	 * @return bool
+	 * @param array $items The array of items (label,value,icon)
+	 * @param array $iArray The "itemsProcFunc." from fieldTSconfig of the field.
+	 * @param array $config The config array for the field.
+	 * @param string $table Table name
+	 * @param array $row Record row
+	 * @param string $field Field name
+	 * @return array The modified $items array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function isPalettesCollapsed($table, $palette) {
-		if (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) && $GLOBALS['TCA'][$table]['palettes'][$palette]['isHiddenPalette']) {
-			return TRUE;
-		}
-		if ($GLOBALS['TCA'][$table]['ctrl']['canNotCollapse']) {
-			return FALSE;
-		}
-		if (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) && $GLOBALS['TCA'][$table]['palettes'][$palette]['canNotCollapse']) {
-			return FALSE;
+	public function procItems($items, $iArray, $config, $table, $row, $field) {
+		GeneralUtility::logDeprecatedFunction();
+		$languageService = $this->getLanguageService();
+		$params = array();
+		$params['items'] = &$items;
+		$params['config'] = $config;
+		$params['TSconfig'] = $iArray;
+		$params['table'] = $table;
+		$params['row'] = $row;
+		$params['field'] = $field;
+		// The itemsProcFunc method may throw an exception.
+		// If it does display an error message and return items unchanged.
+		try {
+			GeneralUtility::callUserFunction($config['itemsProcFunc'], $params, $this);
+		} catch (\Exception $exception) {
+			$fieldLabel = $field;
+			if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) {
+				$fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']);
+			}
+			$message = sprintf(
+				$languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.items_proc_func_error'),
+				$fieldLabel,
+				$exception->getMessage()
+			);
+			/** @var $flashMessage FlashMessage */
+			$flashMessage = GeneralUtility::makeInstance(
+				FlashMessage::class,
+				htmlspecialchars($message),
+				'',
+				FlashMessage::ERROR,
+				TRUE
+			);
+			/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+			$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+			$defaultFlashMessageQueue->enqueue($flashMessage);
 		}
-		return $this->palettesCollapsed;
+		return $items;
 	}
 
 	/**
-	 * Return TSCpid (cached)
-	 * Using BackendUtility::getTSCpid()
+	 * Prints the selector box form-field for the db/file/select elements (multiple)
 	 *
-	 * @param string $table Tablename
-	 * @param string $uid UID value
-	 * @param string $pid PID value
-	 * @return array Array of two integers; first is the real PID of a record, second is the PID value for TSconfig.
-	 * @see BackendUtility::getTSCpid()
+	 * @param string $fName Form element name
+	 * @param string $mode Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type)
+	 * @param string $allowed Commalist of "allowed
+	 * @param array $itemArray The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs.
+	 * @param string $selector Alternative selector box.
+	 * @param array $params An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails
+	 * @param string $onFocus On focus attribute string
+	 * @param string $table (optional) Table name processing for
+	 * @param string $field (optional) Field of table name processing for
+	 * @param string $uid (optional) uid of table record processing for
+	 * @param array $config (optional) The TCA field config
+	 * @throws \RuntimeException
+	 * @return string The form fields for the selection.
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getTSCpid($table, $uid, $pid) {
-		GeneralUtility::logDeprecatedFunction();
-		return BackendUtility::getTSCpidCached($table, $uid, $pid);
+	public function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $table = '', $field = '', $uid = '', $config = array()) {
+		// dbFileIcons() in AbstractFormElement is now protected. The method was never meant to be
+		// called directly. Let's throw a friendly exception if someone still does it.
+		throw new \RuntimeException('dbFileIcons() can not be called directly', 1424031815);
 	}
 
 	/**
-	 * Returns TRUE if descriptions should be loaded always
+	 * Returns array of elements from clipboard to insert into GROUP element box.
 	 *
-	 * @param string $table Table for which to check
-	 * @return bool
+	 * @param string $allowed Allowed elements, Eg "pages,tt_content", "gif,jpg,jpeg,png
+	 * @param string $mode Mode of relations: "db" or "file
+	 * @throws \RuntimeException
+	 * @return array Array of elements in values (keys are insignificant), if none found, empty array.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function doLoadTableDescr($table) {
-		return $GLOBALS['TCA'][$table]['interface']['always_description'];
+	public function getClipboardElements($allowed, $mode) {
+		// getClipboardElements() in AbstractFormElement is now protected. The method was never meant to be
+		// called directly. Let's throw a friendly exception if someone still does it.
+		throw new \RuntimeException('getClipboardElements() can not be called directly', 1424031814);
 	}
 
 	/**
-	 * Returns an array of available languages (to use for FlexForms)
+	 * Overwrite this function in own extended class to add own markers for output
 	 *
-	 * @param bool $onlyIsoCoded If set, only languages which are paired with a static_info_table / static_language record will be returned.
-	 * @param bool $setDefault If set, an array entry for a default language is set.
-	 * @return array
+	 * @param array $marker Array with key/value pairs to insert in the template.
+	 * @param string $table The table name of the record
+	 * @param string $field The field name which this element is supposed to edit
+	 * @param array $row The record data array where the value(s) for the field can be found
+	 * @param array $PA An array with additional configuration options.
+	 * @return array Marker array for template output
+	 * @see function intoTemplate()
 	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getAvailableLanguages($onlyIsoCoded = TRUE, $setDefault = TRUE) {
+	public function addUserTemplateMarkers($marker, $table, $field, $row, &$PA) {
 		GeneralUtility::logDeprecatedFunction();
-		$isL = ExtensionManagementUtility::isLoaded('static_info_tables');
-		// Find all language records in the system:
-		$db = $this->getDatabaseConnection();
-		$res = $db->exec_SELECTquery('language_isocode,static_lang_isocode,title,uid', 'sys_language', 'pid=0 AND hidden=0' . BackendUtility::deleteClause('sys_language'), '', 'title');
-		// Traverse them:
-		$output = array();
-		if ($setDefault) {
-			$output[0] = array(
-				'uid' => 0,
-				'title' => 'Default language',
-				'ISOcode' => 'DEF'
-			);
-		}
-		while ($row = $db->sql_fetch_assoc($res)) {
-			$output[$row['uid']] = $row;
-			if (!empty($row['language_isocode'])) {
-				$output[$row['uid']]['ISOcode'] = $row['language_isocode'];
-			} elseif ($isL && $row['static_lang_isocode']) {
-				\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
-				$rr = BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
-				if ($rr['lg_iso_2']) {
-					$output[$row['uid']]['ISOcode'] = $rr['lg_iso_2'];
-				}
-			}
-			if ($onlyIsoCoded && !$output[$row['uid']]['ISOcode']) {
-				unset($output[$row['uid']]);
-			}
+		return $marker;
+	}
+
+	/**
+	 * Wraps an element in the $out_array with the template row for a "section" ($this->sectionWrap)
+	 *
+	 * @param array $out_array The array with form elements stored in (passed by reference and changed!)
+	 * @param int $out_pointer The pointer to the entry in the $out_array  (passed by reference and incremented!)
+	 * @return void
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, not in use anymore
+	 */
+	public function wrapBorder(&$out_array, &$out_pointer) {
+		GeneralUtility::logDeprecatedFunction();
+		if ($this->sectionWrap && $out_array[$out_pointer]) {
+			$tableAttribs = 'border="0" cellspacing="0" cellpadding="0" width="100%" class="table table-border"';
+			$out_array[$out_pointer] = str_replace('###CONTENT###', $out_array[$out_pointer], str_replace('###TABLE_ATTRIBS###', $tableAttribs, $this->sectionWrap));
+			$out_pointer++;
 		}
-		$db->sql_free_result($res);
-		return $output;
 	}
 
 	/**
-	 * Initializes language icons etc.
+	 * Replaces colorscheme markers in the template string
 	 *
-	 * @param string $table Table name
-	 * @param array $row Record
-	 * @param string $sys_language_uid Sys language uid OR ISO language code prefixed with "v", eg. "vDA
+	 * @param string $inTemplate Template string with markers to be substituted.
 	 * @return string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getLanguageIcon($table, $row, $sys_language_uid) {
-		$mainKey = $table . ':' . $row['uid'];
-		if (!isset($this->cachedLanguageFlag[$mainKey])) {
-			BackendUtility::fixVersioningPid($table, $row);
-			list($tscPID) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
-			/** @var $t8Tools \TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider */
-			$t8Tools = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider::class);
-			$this->cachedLanguageFlag[$mainKey] = $t8Tools->getSystemLanguages($tscPID);
-		}
-		// Convert sys_language_uid to sys_language_uid if input was in fact a string (ISO code expected then)
-		if (!MathUtility::canBeInterpretedAsInteger($sys_language_uid)) {
-			foreach ($this->cachedLanguageFlag[$mainKey] as $rUid => $cD) {
-				if ('v' . $cD['ISOcode'] === $sys_language_uid) {
-					$sys_language_uid = $rUid;
-				}
-			}
-		}
-		$out = '';
-		if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] && $this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] != 'empty-empty') {
-			$out .= IconUtility::getSpriteIcon($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']);
-			$out .= '&nbsp;';
-		} elseif ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) {
-			$out .= '[' . $this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] . ']';
-			$out .= '&nbsp;';
-		}
-		return $out;
+	public function rplColorScheme($inTemplate) {
+		GeneralUtility::logDeprecatedFunction();
+		return str_replace(
+			array(
+				// Colors:
+				'###BGCOLOR###',
+				'###BGCOLOR_HEAD###',
+				'###FONTCOLOR_HEAD###',
+				// Classes:
+				'###CLASSATTR_1###',
+				'###CLASSATTR_2###',
+				'###CLASSATTR_4###'
+			),
+			array(
+				// Colors:
+				$this->colorScheme[0] ? ' bgcolor="' . $this->colorScheme[0] . '"' : '',
+				$this->colorScheme[1] ? ' bgcolor="' . $this->colorScheme[1] . '"' : '',
+				$this->colorScheme[3],
+				// Classes:
+				$this->classScheme[0] ? ' class="' . $this->classScheme[0] . '"' : '',
+				$this->classScheme[1] ? ' class="' . $this->classScheme[1] . '"' : '',
+				$this->classScheme[3] ? ' class="' . $this->classScheme[3] . '"' : ''
+			),
+			$inTemplate
+		);
 	}
 
 	/**
-	 * Renders an icon to indicate the way the translation and the original is merged (if this is relevant).
-	 *
-	 * If a field is defined as 'mergeIfNotBlank' this is useful information for an editor. He/she can leave the field blank and
-	 * the original value will be used. Without this hint editors are likely to copy the contents even if it is not necessary.
+	 * Returns divider.
+	 * Currently not implemented and returns only blank value.
 	 *
-	 * @param string $l10nMode Localization mode from TCA
-	 * @return string
+	 * @return string Empty string
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getMergeBehaviourIcon($l10nMode) {
-		$icon = '';
-		if ($l10nMode === 'mergeIfNotBlank') {
-			$icon = IconUtility::getSpriteIcon('actions-edit-merge-localization', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_misc.xlf:localizeMergeIfNotBlank')));
-		}
-		return $icon;
+	public function getDivider() {
+		GeneralUtility::logDeprecatedFunction();
+		return '';
 	}
 
 	/**
-	 * Rendering preview output of a field value which is not shown as a form field but just outputted.
+	 * Setting the current color scheme ($this->colorScheme) based on $this->defColorScheme plus input string.
 	 *
-	 * @param string $value The value to output
-	 * @param array $config Configuration for field.
-	 * @param string $field Name of field.
-	 * @return string HTML formatted output
+	 * @param string $scheme A color scheme string.
+	 * @return void
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function previewFieldValue($value, $config, $field = '') {
-		if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
-			// Ignore uploadfolder if internal_type is file_reference
-			if ($config['config']['internal_type'] === 'file_reference') {
-				$config['config']['uploadfolder'] = '';
+	public function setColorScheme($scheme) {
+		GeneralUtility::logDeprecatedFunction();
+		$this->colorScheme = $this->defColorScheme;
+		$this->classScheme = $this->defClassScheme;
+		$parts = GeneralUtility::trimExplode(',', $scheme);
+		foreach ($parts as $key => $col) {
+			// Split for color|class:
+			list($color, $class) = GeneralUtility::trimExplode('|', $col);
+			// Handle color values:
+			if ($color) {
+				$this->colorScheme[$key] = $color;
 			}
-			$show_thumbs = TRUE;
-			$table = 'tt_content';
-			// Making the array of file items:
-			$itemArray = GeneralUtility::trimExplode(',', $value, TRUE);
-			// Showing thumbnails:
-			$thumbsnail = '';
-			if ($show_thumbs) {
-				$imgs = array();
-				foreach ($itemArray as $imgRead) {
-					$imgP = explode('|', $imgRead);
-					$imgPath = rawurldecode($imgP[0]);
-					$rowCopy = array();
-					$rowCopy[$field] = $imgPath;
-					// Icon + clickmenu:
-					$absFilePath = GeneralUtility::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
-					$fileInformation = pathinfo($imgPath);
-					$fileIcon = IconUtility::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . GeneralUtility::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!'))));
-					$imgs[] = '<span class="nobr">' . BackendUtility::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>';
-				}
-				$thumbsnail = implode('<br />', $imgs);
+			if ($color == '-') {
+				$this->colorScheme[$key] = '';
+			}
+			// Handle class values:
+			if ($class) {
+				$this->classScheme[$key] = $class;
+			}
+			if ($class == '-') {
+				$this->classScheme[$key] = '';
 			}
-			return $thumbsnail;
-		} else {
-			return nl2br(htmlspecialchars($value));
 		}
 	}
 
 	/**
-	 * Generates and return information about which languages the current user should see in preview, configured by options.additionalPreviewLanguages
+	 * Reset color schemes.
 	 *
-	 * @return array Array of additional languages to preview
+	 * @return void
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getAdditionalPreviewLanguages() {
-		if (!isset($this->cachedAdditionalPreviewLanguages)) {
-			$this->cachedAdditionalPreviewLanguages = array();
-			if ($this->getBackendUserAuthentication()->getTSConfigVal('options.additionalPreviewLanguages')) {
-				$uids = GeneralUtility::intExplode(',', $this->getBackendUserAuthentication()->getTSConfigVal('options.additionalPreviewLanguages'));
-				foreach ($uids as $uid) {
-					if ($sys_language_rec = BackendUtility::getRecord('sys_language', $uid)) {
-						$this->cachedAdditionalPreviewLanguages[$uid] = array('uid' => $uid);
-						if (!empty($sys_language_rec['language_isocode'])) {
-							$this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $sys_language_rec['language_isocode'];
-						} elseif ($sys_language_rec['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) {
-							\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
-							$staticLangRow = BackendUtility::getRecord('static_languages', $sys_language_rec['static_lang_isocode'], 'lg_iso_2');
-							if ($staticLangRow['lg_iso_2']) {
-								$this->cachedAdditionalPreviewLanguages[$uid]['uid'] = $uid;
-								$this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $staticLangRow['lg_iso_2'];
-							}
-						}
-					}
-				}
-			}
-		}
-		return $this->cachedAdditionalPreviewLanguages;
+	public function resetSchemes() {
+		GeneralUtility::logDeprecatedFunction();
+		$this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][0]);
+		$this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
+		$this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0];
 	}
 
 	/**
-	 * Push a new element to the dynNestedStack. Thus, every object know, if it's
-	 * nested in a tab or IRRE level and in which order this was processed.
+	 * Store current color scheme
 	 *
-	 * @param string $type Type of the level, e.g. "tab" or "inline
-	 * @param string $ident Identifier of the level
 	 * @return void
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function pushToDynNestedStack($type, $ident) {
-		$this->dynNestedStack[] = array($type, $ident);
+	public function storeSchemes() {
+		GeneralUtility::logDeprecatedFunction();
+		$this->savedSchemes['classScheme'] = $this->classScheme;
+		$this->savedSchemes['colorScheme'] = $this->colorScheme;
+		$this->savedSchemes['fieldStyle'] = $this->fieldStyle;
+		$this->savedSchemes['borderStyle'] = $this->borderStyle;
 	}
 
 	/**
-	 * Remove an element from the dynNestedStack. If $type and $ident
-	 * are set, the last element will only be removed, if it matches
-	 * what is expected to be removed.
+	 * Restore the saved color scheme
 	 *
-	 * @param string $type Type of the level, e.g. "tab" or "inline
-	 * @param string $ident Identifier of the level
 	 * @return void
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function popFromDynNestedStack($type = NULL, $ident = NULL) {
-		if ($type != NULL && $ident != NULL) {
-			$last = end($this->dynNestedStack);
-			if ($type == $last[0] && $ident == $last[1]) {
-				array_pop($this->dynNestedStack);
-			}
-		} else {
-			array_pop($this->dynNestedStack);
-		}
+	public function restoreSchemes() {
+		GeneralUtility::logDeprecatedFunction();
+		$this->classScheme = $this->savedSchemes['classScheme'];
+		$this->colorScheme = $this->savedSchemes['colorScheme'];
+		$this->fieldStyle = $this->savedSchemes['fieldStyle'];
+		$this->borderStyle = $this->savedSchemes['borderStyle'];
 	}
 
 	/**
-	 * Get the dynNestedStack as associative array.
-	 * The result is e.g. ['tab','DTM-ABCD-1'], ['inline','data[13][table][uid][field]'], ['tab','DTM-DEFG-2'], ...
+	 * Gets default record. Maybe not used anymore. FE-editor?
 	 *
-	 * @param bool $json Return a JSON string instead of an array - default: FALSE
-	 * @param bool $skipFirst Skip the first element in the dynNestedStack - default: FALSE
-	 * @return mixed Returns an associative array by default. If $json is TRUE, it will be returned as JSON string.
+	 * @param string $table Database Tablename
+	 * @param int $pid PID value (positive / negative)
+	 * @return array|NULL "default" row.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getDynNestedStack($json = FALSE, $skipFirst = FALSE) {
-		$result = $this->dynNestedStack;
-		if ($skipFirst) {
-			array_shift($result);
+	public function getDefaultRecord($table, $pid = 0) {
+		GeneralUtility::logDeprecatedFunction();
+		if ($GLOBALS['TCA'][$table]) {
+			$row = array();
+			if ($pid < 0 && $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
+				// Fetches the previous record:
+				$db = $this->getDatabaseConnection();
+				$res = $db->exec_SELECTquery('*', $table, 'uid=' . abs($pid) . BackendUtility::deleteClause($table));
+				if ($drow = $db->sql_fetch_assoc($res)) {
+					// Gets the list of fields to copy from the previous record.
+					$fArr = explode(',', $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']);
+					foreach ($fArr as $theF) {
+						if ($GLOBALS['TCA'][$table]['columns'][$theF]) {
+							$row[$theF] = $drow[$theF];
+						}
+					}
+				}
+				$db->sql_free_result($res);
+			}
+			foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $info) {
+				if (isset($info['config']['default'])) {
+					$row[$field] = $info['config']['default'];
+				}
+			}
+			return $row;
 		}
-		return $json ? json_encode($result) : $result;
+		return NULL;
 	}
 
 	/**
-	 * Takes care of registering properties in requiredFields and requiredElements.
-	 * The current hierarchy of IRRE and/or Tabs is stored. Thus, it is possible to determine,
-	 * which required field/element was filled incorrectly and show it, even if the Tab or IRRE
-	 * level is hidden.
+	 * Fetches language label for key
 	 *
-	 * @param string $type Type of requirement ('field' or 'range')
-	 * @param string $name The name of the form field
-	 * @param mixed $value For type 'field' string, for type 'range' array
-	 * @return void
+	 * @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 registerRequiredProperty($type, $name, $value) {
-		if ($type == 'field' && is_string($value)) {
-			$this->requiredFields[$name] = $value;
-			// requiredFields have name/value swapped! For backward compatibility we keep this:
-			$itemName = $value;
-		} elseif ($type == 'range' && is_array($value)) {
-			$this->requiredElements[$name] = $value;
-			$itemName = $name;
-		} else {
-			$itemName = '';
-		}
-		// Set the situation of nesting for the current field:
-		$this->registerNestedElement($itemName);
+	public function sL($str) {
+		GeneralUtility::logDeprecatedFunction();
+		return $this->getLanguageService()->sL($str);
 	}
 
 	/**
-	 * Sets the current situation of nested tabs and inline levels for a given element.
+	 * Returns language label from locallang_core.xlf
+	 * Labels must be prefixed with either "l_" or "m_".
+	 * The prefix "l_" maps to the prefix "labels." inside locallang_core.xlf
+	 * The prefix "m_" maps to the prefix "mess." inside locallang_core.xlf
 	 *
-	 * @param string $itemName The element the nesting should be stored for
-	 * @param bool $setLevel Set the reverse level lookup - default: TRUE
-	 * @return void
+	 * @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
 	 */
-	protected function registerNestedElement($itemName, $setLevel = TRUE) {
-		$dynNestedStack = $this->getDynNestedStack();
-		if (count($dynNestedStack) && preg_match('/^(.+\\])\\[(\\w+)\\]$/', $itemName, $match)) {
-			array_shift($match);
-			$this->requiredNested[$itemName] = array(
-				'parts' => $match,
-				'level' => $dynNestedStack
-			);
+	public function getLL($str) {
+		GeneralUtility::logDeprecatedFunction();
+		$content = '';
+		switch (substr($str, 0, 2)) {
+			case 'l_':
+				$content = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.' . substr($str, 2));
+				break;
+			case 'm_':
+				$content = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.' . substr($str, 2));
+				break;
 		}
+		return $content;
 	}
 
 	/**
-	 * Return the placeholder attribute for an input field.
+	 * Return TSCpid (cached)
+	 * Using BackendUtility::getTSCpid()
 	 *
-	 * @param string $table
-	 * @param string $field
-	 * @param array $config
-	 * @param array $row
-	 * @return string
+	 * @param string $table Tablename
+	 * @param string $uid UID value
+	 * @param string $pid PID value
+	 * @return array Array of two integers; first is the real PID of a record, second is the PID value for TSconfig.
+	 * @see BackendUtility::getTSCpid()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	public function getPlaceholderAttribute($table, $field, array $config, array $row) {
-		$value = $this->getPlaceholderValue($table, $field, $config, $row);
-
-		// Cleanup the string and support 'LLL:'
-		$value = htmlspecialchars(trim($this->getLanguageService()->sL($value)));
-		return empty($value) ? '' : ' placeholder="' . $value . '" ';
+	public function getTSCpid($table, $uid, $pid) {
+		GeneralUtility::logDeprecatedFunction();
+		return BackendUtility::getTSCpidCached($table, $uid, $pid);
 	}
 
 	/**
-	 * Determine and get the value for the placeholder for an input field.
+	 * Returns an array of available languages (to use for FlexForms)
 	 *
-	 * @param string $table
-	 * @param string $field
-	 * @param array $config
-	 * @param array $row
-	 * @return mixed
+	 * @param bool $onlyIsoCoded If set, only languages which are paired with a static_info_table / static_language record will be returned.
+	 * @param bool $setDefault If set, an array entry for a default language is set.
+	 * @return array
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getPlaceholderValue($table, $field, array $config, array $row) {
-		$value = trim($config['placeholder']);
-		if (!$value) {
-			return '';
+	public function getAvailableLanguages($onlyIsoCoded = TRUE, $setDefault = TRUE) {
+		GeneralUtility::logDeprecatedFunction();
+		$isL = ExtensionManagementUtility::isLoaded('static_info_tables');
+		// Find all language records in the system:
+		$db = $this->getDatabaseConnection();
+		$res = $db->exec_SELECTquery('language_isocode,static_lang_isocode,title,uid', 'sys_language', 'pid=0 AND hidden=0' . BackendUtility::deleteClause('sys_language'), '', 'title');
+		// Traverse them:
+		$output = array();
+		if ($setDefault) {
+			$output[0] = array(
+				'uid' => 0,
+				'title' => 'Default language',
+				'ISOcode' => 'DEF'
+			);
 		}
-		// Check if we have a reference to another field value from the current record
-		if (substr($value, 0, 6) === '__row|') {
-			/** @var \TYPO3\CMS\Backend\Form\FormDataTraverser $traverser */
-			$traverseFields = GeneralUtility::trimExplode('|', substr($value, 6));
-			$traverser = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormDataTraverser::class, $this);
-			$value = $traverser->getTraversedFieldValue($traverseFields, $table, $row);
+		while ($row = $db->sql_fetch_assoc($res)) {
+			$output[$row['uid']] = $row;
+			if (!empty($row['language_isocode'])) {
+				$output[$row['uid']]['ISOcode'] = $row['language_isocode'];
+			} elseif ($isL && $row['static_lang_isocode']) {
+				\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
+				$rr = BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
+				if ($rr['lg_iso_2']) {
+					$output[$row['uid']]['ISOcode'] = $rr['lg_iso_2'];
+				}
+			}
+			if ($onlyIsoCoded && !$output[$row['uid']]['ISOcode']) {
+				unset($output[$row['uid']]);
+			}
 		}
-
-		return $value;
+		$db->sql_free_result($res);
+		return $output;
 	}
 
 	/**
-	 * Insert additional style sheet link
+	 * Returns TSconfig for table/row
+	 * Multiple requests to this function will return cached content so there is no performance loss in calling
+	 * this many times since the information is looked up only once.
 	 *
-	 * @param string $key Some key identifying the style sheet
-	 * @param string $href Uri to the style sheet file
-	 * @param string $title Value for the title attribute of the link element
-	 * @param string $relation Value for the rel attribute of the link element
-	 * @return void
-	 */
-	public function addStyleSheet($key, $href, $title = '', $relation = 'stylesheet') {
-		$this->getControllerDocumentTemplate()->addStyleSheet($key, $href, $title, $relation);
-	}
-
-	/**
-	 * @return BackendUserAuthentication
+	 * @param string $table The table name
+	 * @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
+	 * @param string $field Optionally you can specify the field name as well. In that case the TSconfig for the field is returned.
+	 * @return mixed The TSconfig values (probably in an array)
+	 * @see BackendUtility::getTCEFORM_TSconfig()
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getBackendUserAuthentication() {
-		return $GLOBALS['BE_USER'];
+	public function setTSconfig($table, $row, $field = '') {
+		GeneralUtility::logDeprecatedFunction();
+		$mainKey = $table . ':' . $row['uid'];
+		if (!isset($this->cachedTSconfig[$mainKey])) {
+			$this->cachedTSconfig[$mainKey] = BackendUtility::getTCEFORM_TSconfig($table, $row);
+		}
+		if ($field) {
+			return $this->cachedTSconfig[$mainKey][$field];
+		} else {
+			return $this->cachedTSconfig[$mainKey];
+		}
 	}
 
 	/**
-	 * @return DocumentTemplate
+	 * Add selector box items of more exotic kinds.
+	 *
+	 * @param array $items The array of items (label,value,icon)
+	 * @param array $fieldValue The "columns" array for the field (from TCA)
+	 * @param array $TSconfig TSconfig for the table/row
+	 * @param string $field The fieldname
+	 * @return array The $items array modified.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getControllerDocumentTemplate() {
-		// $GLOBALS['SOBE'] might be any kind of PHP class (controller most of the times)
-		// These class do not inherit from any common class, but they all seem to have a "doc" member
-		return $GLOBALS['SOBE']->doc;
+	public function addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field) {
+		GeneralUtility::logDeprecatedFunction();
+		return FormEngineUtility::addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field);
 	}
 
 	/**
-	 * @return DatabaseConnection
+	 * Creates value/label pair for a backend module (main and sub)
+	 *
+	 * @param string $value The module key
+	 * @return string The rawurlencoded 2-part string to transfer to interface
+	 * @access private
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getDatabaseConnection() {
-		return $GLOBALS['TYPO3_DB'];
+	public function addSelectOptionsToItemArray_makeModuleData($value) {
+		GeneralUtility::logDeprecatedFunction();
+		$label = '';
+		// Add label for main module:
+		$pp = explode('_', $value);
+		if (count($pp) > 1) {
+			$label .= $this->getLanguageService()->moduleLabels['tabs'][($pp[0] . '_tab')] . '>';
+		}
+		// Add modules own label now:
+		$label .= $this->getLanguageService()->moduleLabels['tabs'][$value . '_tab'];
+		return $label;
 	}
 
 	/**
-	 * @return LanguageService
+	 * Adds records from a foreign table (for selector boxes)
+	 *
+	 * @param array $items The array of items (label,value,icon)
+	 * @param array $fieldValue The 'columns' array for the field (from TCA)
+	 * @param array $TSconfig TSconfig for the table/row
+	 * @param string $field The fieldname
+	 * @param bool $pFFlag If set, then we are fetching the 'neg_' foreign tables.
+	 * @return array The $items array modified.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getLanguageService() {
-		return $GLOBALS['LANG'];
+	public function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = FALSE) {
+		GeneralUtility::logDeprecatedFunction();
+		$languageService = $this->getLanguageService();
+		// Init:
+		$pF = $pFFlag ? 'neg_' : '';
+		$f_table = $fieldValue['config'][$pF . 'foreign_table'];
+		$uidPre = $pFFlag ? '-' : '';
+		// Exec query:
+		$res = BackendUtility::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
+		// Perform error test
+		$db = $this->getDatabaseConnection();
+		if ($db->sql_error()) {
+			$msg = htmlspecialchars($db->sql_error());
+			$msg .= '<br />' . LF;
+			$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(FlashMessage::class, $msg, $msgTitle, FlashMessage::ERROR, TRUE);
+			/** @var $flashMessageService FlashMessageService */
+			$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+			/** @var $defaultFlashMessageQueue FlashMessageQueue */
+			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+			$defaultFlashMessageQueue->enqueue($flashMessage);
+			return array();
+		}
+		// Get label 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']);
+		// Traverse the selected rows to add them:
+		while ($row = $db->sql_fetch_assoc($res)) {
+			BackendUtility::workspaceOL($f_table, $row);
+			if (is_array($row)) {
+				// Prepare the icon if available:
+				if ($iField && $iPath && $row[$iField]) {
+					$iParts = GeneralUtility::trimExplode(',', $row[$iField], TRUE);
+					$icon = '../' . $iPath . '/' . trim($iParts[0]);
+				} elseif (GeneralUtility::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
+					$icon = IconUtility::mapRecordTypeToSpriteIconName($f_table, $row);
+				} else {
+					$icon = '';
+				}
+				// Add the item:
+				$items[] = array(
+					$lPrefix . htmlspecialchars(BackendUtility::getRecordTitle($f_table, $row)),
+					$uidPre . $row['uid'],
+					$icon
+				);
+			}
+		}
+		$db->sql_free_result($res);
+		return $items;
 	}
 
 	/**
-	 * @return DocumentTemplate
+	 * Rendering wizards for form fields.
+	 *
+	 * @param array $itemKinds Array with the real item in the first value, and an alternative item in the second value.
+	 * @param array $wizConf The "wizard" key from the config array for the field (from TCA)
+	 * @param string $table Table name
+	 * @param array $row The record array
+	 * @param string $field The field name
+	 * @param array $PA Additional configuration array. (passed by reference!)
+	 * @param string $itemName The field name
+	 * @param array $specConf Special configuration if available.
+	 * @param bool $RTE Whether the RTE could have been loaded.
+	 * @return string The new item value.
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
-	protected function getDocumentTemplate() {
-		return $GLOBALS['TBE_TEMPLATE'];
+	public function renderWizards($itemKinds, $wizConf, $table, $row, $field, &$PA, $itemName, $specConf, $RTE = FALSE) {
+		// renderWizards() in AbstractFormElement is now protected. The method was never meant to be
+		// called directly. Let's throw a friendly exception if someone still does it.
+		throw new \RuntimeException('renderWizards() can not be called directly', 1424031813);
 	}
 
 }
diff --git a/typo3/sysext/backend/Classes/Form/FrontendFormEngine.php b/typo3/sysext/backend/Classes/Form/FrontendFormEngine.php
index 681de1fc62ac8fd07dfb7a2518a456a4002b3219..433994761f69d8dbfcf999f613aadedb1af1b9db 100644
--- a/typo3/sysext/backend/Classes/Form/FrontendFormEngine.php
+++ b/typo3/sysext/backend/Classes/Form/FrontendFormEngine.php
@@ -55,7 +55,7 @@ class FrontendFormEngine extends \TYPO3\CMS\Backend\Form\FormEngine {
 			$iRow[] = '<td valign="top">' . '<img name="req_' . $content['TABLE'] . '_' . $content['ID'] . '_' . $content['FIELD'] . '" src="clear.gif" width="10" height="10" alt="" /></td><td nowrap="nowrap" valign="top">' . $content['ITEM'] . $content['HELP_ICON'] . '</td>';
 		}
 		$out = '<table border="0" cellpadding="0" cellspacing="0">
-			<tr><td><img src="clear.gif" width="' . (int)$this->paletteMargin . '" height="1" alt="" /></td>' . implode('', $hRow) . '</tr>
+			<tr><td><img src="clear.gif" width="1" height="1" alt="" /></td>' . implode('', $hRow) . '</tr>
 			<tr><td></td>' . implode('', $iRow) . '</tr>
 		</table>';
 		return $out;
@@ -135,11 +135,7 @@ class FrontendFormEngine extends \TYPO3\CMS\Backend\Form\FormEngine {
 	 * @return string
 	 */
 	private function prependBackPath($url) {
-		if (strpos($url, '://') !== FALSE || $url[0] === '/') {
-			return $url;
-		} else {
-			return $this->backPath . $url;
-		}
+		return $url;
 	}
 
 }
diff --git a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
new file mode 100644
index 0000000000000000000000000000000000000000..bc6363f7cae9726042d58bdb19ea8670613a01e4
--- /dev/null
+++ b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
@@ -0,0 +1,620 @@
+<?php
+namespace TYPO3\CMS\Backend\Form\Utility;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
+
+/**
+ * This is a static, internal and intermediate helper class for various
+ * FormEngine related tasks.
+ *
+ * This class was introduced to help disentangling FormEngine and
+ * its sub classes. It MUST NOT be used in other extensions and will
+ * change or vanish without further notice.
+ *
+ * @internal
+ * @todo: These helpers are target to be dropped if further FormEngine refactoring is done
+ */
+class FormEngineUtility {
+
+	/**
+	 * Whitelist that allows TCA field configuration to be overridden by TSconfig
+	 *
+	 * @see overrideFieldConf()
+	 * @var array
+	 */
+	static protected $allowOverrideMatrix = array(
+		'input' => array('size', 'max', 'readOnly'),
+		'text' => array('cols', 'rows', 'wrap', 'readOnly'),
+		'check' => array('cols', 'showIfRTE', 'readOnly'),
+		'select' => array('size', 'autoSizeMax', 'maxitems', 'minitems', 'readOnly', 'treeConfig'),
+		'group' => array('size', 'autoSizeMax', 'max_size', 'show_thumbs', 'maxitems', 'minitems', 'disable_controls', 'readOnly'),
+		'inline' => array('appearance', 'behaviour', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label', 'readOnly'),
+	);
+
+	/**
+	 * @var array Cache of getLanguageIcon()
+	 */
+	static protected $cachedLanguageFlag = array();
+
+	/**
+	 * Overrides the TCA field configuration by TSconfig settings.
+	 *
+	 * Example TSconfig: TCEform.<table>.<field>.config.appearance.useSortable = 1
+	 * This overrides the setting in $GLOBALS['TCA'][<table>]['columns'][<field>]['config']['appearance']['useSortable'].
+	 *
+	 * @param array $fieldConfig $GLOBALS['TCA'] field configuration
+	 * @param array $TSconfig TSconfig
+	 * @return array Changed TCA field configuration
+	 * @internal
+	 */
+	static public function overrideFieldConf($fieldConfig, $TSconfig) {
+		if (is_array($TSconfig)) {
+			$TSconfig = GeneralUtility::removeDotsFromTS($TSconfig);
+			$type = $fieldConfig['type'];
+			if (is_array($TSconfig['config']) && is_array(static::$allowOverrideMatrix[$type])) {
+				// Check if the keys in TSconfig['config'] are allowed to override TCA field config:
+				foreach ($TSconfig['config'] as $key => $_) {
+					if (!in_array($key, static::$allowOverrideMatrix[$type], TRUE)) {
+						unset($TSconfig['config'][$key]);
+					}
+				}
+				// Override $GLOBALS['TCA'] field config by remaining TSconfig['config']:
+				if (count($TSconfig['config'])) {
+					ArrayUtility::mergeRecursiveWithOverrule($fieldConfig, $TSconfig['config']);
+				}
+			}
+		}
+		return $fieldConfig;
+	}
+
+	/**
+	 * Initializes language icons etc.
+	 *
+	 * @param string $table Table name
+	 * @param array $row Record
+	 * @param string $sys_language_uid Sys language uid OR ISO language code prefixed with "v", eg. "vDA
+	 * @return string
+	 * @internal
+	 */
+	static public function getLanguageIcon($table, $row, $sys_language_uid) {
+		$mainKey = $table . ':' . $row['uid'];
+		if (!isset(static::$cachedLanguageFlag[$mainKey])) {
+			BackendUtility::fixVersioningPid($table, $row);
+			list($tscPID) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
+			/** @var $t8Tools TranslationConfigurationProvider */
+			$t8Tools = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
+			static::$cachedLanguageFlag[$mainKey] = $t8Tools->getSystemLanguages($tscPID);
+		}
+		// Convert sys_language_uid to sys_language_uid if input was in fact a string (ISO code expected then)
+		if (!MathUtility::canBeInterpretedAsInteger($sys_language_uid)) {
+			foreach (static::$cachedLanguageFlag[$mainKey] as $rUid => $cD) {
+				if ('v' . $cD['ISOcode'] === $sys_language_uid) {
+					$sys_language_uid = $rUid;
+				}
+			}
+		}
+		$out = '';
+		if (static::$cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] && static::$cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] != 'empty-empty') {
+			$out .= IconUtility::getSpriteIcon(static::$cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']);
+			$out .= '&nbsp;';
+		} elseif (static::$cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) {
+			$out .= '[' . static::$cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] . ']';
+			$out .= '&nbsp;';
+		}
+		return $out;
+	}
+
+	/**
+	 * Returns TSconfig for given table and row
+	 *
+	 * @param string $table The table name
+	 * @param array $row The table row - Must at least contain the "uid" value, even if "NEW..." string.
+	 *                   The "pid" field is important as well, negative values will be interpreted as pointing to a record from the same table.
+	 * @param string $field Optionally specify the field name as well. In that case the TSconfig for this field is returned.
+	 * @return mixed The TSconfig values - probably in an array
+	 * @internal
+	 */
+	static public function getTSconfigForTableRow($table, $row, $field = '') {
+		static $cache;
+		if (is_null($cache)) {
+			$cache = array();
+		}
+		$cacheIdentifier = $table . ':' . $row['uid'];
+		if (!isset($cache[$cacheIdentifier])) {
+			$cache[$cacheIdentifier] = BackendUtility::getTCEFORM_TSconfig($table, $row);
+		}
+		if ($field) {
+			return $cache[$cacheIdentifier][$field];
+		}
+		return $cache[$cacheIdentifier];
+	}
+
+	/**
+	 * Extracting values from a value/label list (as made by transferData class)
+	 *
+	 * @param array $itemFormElValue Values in an array
+	 * @return array Input string exploded with comma and for each value only the label part is set in the array. Keys are numeric
+	 * @internal
+	 */
+	static public function extractValuesOnlyFromValueLabelList($itemFormElValue) {
+		// Get values of selected items:
+		$itemArray = GeneralUtility::trimExplode(',', $itemFormElValue, TRUE);
+		foreach ($itemArray as $tk => $tv) {
+			$tvP = explode('|', $tv, 2);
+			$tvP[0] = rawurldecode($tvP[0]);
+			$itemArray[$tk] = $tvP[0];
+		}
+		return $itemArray;
+	}
+
+	/**
+	 * Get icon (for example for selector boxes)
+	 *
+	 * @param string $icon Icon reference
+	 * @return array Array with two values; the icon file reference, the icon file information array (getimagesize())
+	 * @internal
+	 */
+	static public function getIcon($icon) {
+		$selIconInfo = FALSE;
+		if (substr($icon, 0, 4) == 'EXT:') {
+			$file = GeneralUtility::getFileAbsFileName($icon);
+			if ($file) {
+				$file = PathUtility::stripPathSitePrefix($file);
+				$selIconFile = '../' . $file;
+				$selIconInfo = @getimagesize((PATH_site . $file));
+			} else {
+				$selIconFile = '';
+			}
+		} elseif (substr($icon, 0, 3) == '../') {
+			$selIconFile = GeneralUtility::resolveBackPath($icon);
+			if (is_file(PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3)))) {
+				$selIconInfo = getimagesize((PATH_site . GeneralUtility::resolveBackPath(substr($icon, 3))));
+			}
+		} elseif (substr($icon, 0, 4) == 'ext/' || substr($icon, 0, 7) == 'sysext/') {
+			$selIconFile = $icon;
+			if (is_file(PATH_typo3 . $icon)) {
+				$selIconInfo = getimagesize(PATH_typo3 . $icon);
+			}
+		} else {
+			$selIconFile = IconUtility::skinImg('', 'gfx/' . $icon, '', 1);
+			$iconPath = $selIconFile;
+			if (is_file(PATH_typo3 . $iconPath)) {
+				$selIconInfo = getimagesize(PATH_typo3 . $iconPath);
+			}
+		}
+		if ($selIconInfo === FALSE) {
+			// Unset to empty string if icon is not available
+			$selIconFile = '';
+		}
+		return array($selIconFile, $selIconInfo);
+	}
+
+	/**
+	 * Renders the $icon, supports a filename for skinImg or sprite-icon-name
+	 *
+	 * @param string $icon The icon passed, could be a file-reference or a sprite Icon name
+	 * @param string $alt Alt attribute of the icon returned
+	 * @param string $title Title attribute of the icon return
+	 * @return string A tag representing to show the asked icon
+	 * @internal
+	 */
+	static public function getIconHtml($icon, $alt = '', $title = '') {
+		$iconArray = static::getIcon($icon);
+		if (!empty($iconArray[0]) && is_file(GeneralUtility::resolveBackPath(PATH_typo3 . PATH_typo3_mod . $iconArray[0]))) {
+			return '<img src="' . $iconArray[0] . '" alt="' . $alt . '" ' . ($title ? 'title="' . $title . '"' : '') . ' />';
+		} else {
+			return IconUtility::getSpriteIcon($icon, array('alt' => $alt, 'title' => $title));
+		}
+	}
+
+	/**
+	 * Creates style attribute content for option tags in a selector box, primarily setting
+	 * it up to show the icon of an element as background image (works in mozilla)
+	 *
+	 * @param string $iconString Icon string for option item
+	 * @return string Style attribute content, if any
+	 * @internal
+	 */
+	static public function optionTagStyle($iconString) {
+		if (!$iconString) {
+			return '';
+		}
+		list($selIconFile, $selIconInfo) = static::getIcon($iconString);
+		if (empty($selIconFile)) {
+			// Skip background style if image is unavailable
+			return '';
+		}
+		$padLeft = $selIconInfo[0] + 4;
+		if ($padLeft >= 18 && $padLeft <= 24) {
+			// In order to get the same padding for all option tags even if icon sizes differ a little,
+			// set it to 22 if it was between 18 and 24 pixels
+			$padLeft = 22;
+		}
+		$padTop = MathUtility::forceIntegerInRange(($selIconInfo[1] - 12) / 2, 0);
+		$styleAttr = 'background: #fff url(' . $selIconFile . ') 0% 50% no-repeat; height: '
+			. MathUtility::forceIntegerInRange(($selIconInfo[1] + 2 - $padTop), 0)
+			. 'px; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;';
+		return $styleAttr;
+	}
+
+	/**
+	 * Initialize item array (for checkbox, selectorbox, radio buttons)
+	 * Will resolve the label value.
+	 *
+	 * @param array $fieldValue The "columns" array for the field (from TCA)
+	 * @return array An array of arrays with three elements; label, value, icon
+	 * @internal
+	 */
+	static public function initItemArray($fieldValue) {
+		$languageService = static::getLanguageService();
+		$items = array();
+		if (is_array($fieldValue['config']['items'])) {
+			foreach ($fieldValue['config']['items'] as $itemValue) {
+				$items[] = array($languageService->sL($itemValue[0]), $itemValue[1], $itemValue[2]);
+			}
+		}
+		return $items;
+	}
+
+	/**
+	 * Merges items into an item-array, optionally with an icon
+	 * example:
+	 * TCEFORM.pages.doktype.addItems.13 = My Label
+	 * TCEFORM.pages.doktype.addItems.13.icon = EXT:t3skin/icons/gfx/i/pages.gif
+	 *
+	 * @param array $items The existing item array
+	 * @param array $iArray An array of items to add. NOTICE: The keys are mapped to values, and the values and mapped to be labels. No possibility of adding an icon.
+	 * @return array The updated $item array
+	 * @internal
+	 */
+	static public function addItems($items, $iArray) {
+		$languageService = static::getLanguageService();
+		if (is_array($iArray)) {
+			foreach ($iArray as $value => $label) {
+				// if the label is an array (that means it is a subelement
+				// like "34.icon = mylabel.png", skip it (see its usage below)
+				if (is_array($label)) {
+					continue;
+				}
+				// check if the value "34 = mylabel" also has a "34.icon = myimage.png"
+				if (isset($iArray[$value . '.']) && $iArray[$value . '.']['icon']) {
+					$icon = $iArray[$value . '.']['icon'];
+				} else {
+					$icon = '';
+				}
+				$items[] = array($languageService->sL($label), $value, $icon);
+			}
+		}
+		return $items;
+	}
+
+	/**
+	 * Add selector box items of more exotic kinds.
+	 *
+	 * @param array $items The array of items (label,value,icon)
+	 * @param array $fieldValue The "columns" array for the field (from TCA)
+	 * @param array $TSconfig TSconfig for the table/row
+	 * @param string $field The fieldname
+	 * @return array The $items array modified.
+	 * @internal
+	 */
+	static public function addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field) {
+		$languageService = static::getLanguageService();
+
+		// Values from foreign tables:
+		if ($fieldValue['config']['foreign_table']) {
+			$items = static::foreignTable($items, $fieldValue, $TSconfig, $field);
+			if ($fieldValue['config']['neg_foreign_table']) {
+				$items = static::foreignTable($items, $fieldValue, $TSconfig, $field, 1);
+			}
+		}
+
+		// Values from a file folder:
+		if ($fieldValue['config']['fileFolder']) {
+			$fileFolder = GeneralUtility::getFileAbsFileName($fieldValue['config']['fileFolder']);
+			if (@is_dir($fileFolder)) {
+				// Configurations:
+				$extList = $fieldValue['config']['fileFolder_extList'];
+				$recursivityLevels = isset($fieldValue['config']['fileFolder_recursions'])
+					? MathUtility::forceIntegerInRange($fieldValue['config']['fileFolder_recursions'], 0, 99)
+					: 99;
+				// Get files:
+				$fileFolder = rtrim($fileFolder, '/') . '/';
+				$fileArr = GeneralUtility::getAllFilesAndFoldersInPath(array(), $fileFolder, $extList, 0, $recursivityLevels);
+				$fileArr = GeneralUtility::removePrefixPathFromList($fileArr, $fileFolder);
+				foreach ($fileArr as $fileRef) {
+					$fI = pathinfo($fileRef);
+					$icon = GeneralUtility::inList('gif,png,jpeg,jpg', strtolower($fI['extension']))
+						? '../' . PathUtility::stripPathSitePrefix($fileFolder) . $fileRef
+						: '';
+					$items[] = array(
+						$fileRef,
+						$fileRef,
+						$icon
+					);
+				}
+			}
+		}
+
+		// If 'special' is configured:
+		if ($fieldValue['config']['special']) {
+			switch ($fieldValue['config']['special']) {
+				case 'tables':
+					foreach ($GLOBALS['TCA'] as $theTableNames => $_) {
+						if (!$GLOBALS['TCA'][$theTableNames]['ctrl']['adminOnly']) {
+							// Icon:
+							$icon = IconUtility::mapRecordTypeToSpriteIconName($theTableNames, array());
+							// Add help text
+							$helpText = array();
+							$languageService->loadSingleTableDescription($theTableNames);
+							$helpTextArray = $GLOBALS['TCA_DESCR'][$theTableNames]['columns'][''];
+							if (!empty($helpTextArray['description'])) {
+								$helpText['description'] = $helpTextArray['description'];
+							}
+							// Item configuration:
+							$items[] = array(
+								$languageService->sL($GLOBALS['TCA'][$theTableNames]['ctrl']['title']),
+								$theTableNames,
+								$icon,
+								$helpText
+							);
+						}
+					}
+					break;
+				case 'pagetypes':
+					$theTypes = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
+					foreach ($theTypes as $theTypeArrays) {
+						// Icon:
+						$icon = 'empty-emtpy';
+						if ($theTypeArrays[1] != '--div--') {
+							$icon = IconUtility::mapRecordTypeToSpriteIconName('pages', array('doktype' => $theTypeArrays[1]));
+						}
+						// Item configuration:
+						$items[] = array(
+							$languageService->sL($theTypeArrays[0]),
+							$theTypeArrays[1],
+							$icon
+						);
+					}
+					break;
+				case 'exclude':
+					$theTypes = BackendUtility::getExcludeFields();
+					foreach ($theTypes as $theTypeArrays) {
+						list($theTable, $theFullField) = explode(':', $theTypeArrays[1]);
+						// If the field comes from a FlexForm, the syntax is more complex
+						$theFieldParts = explode(';', $theFullField);
+						$theField = array_pop($theFieldParts);
+						// Add header if not yet set for table:
+						if (!array_key_exists($theTable, $items)) {
+							$icon = IconUtility::mapRecordTypeToSpriteIconName($theTable, array());
+							$items[$theTable] = array(
+								$languageService->sL($GLOBALS['TCA'][$theTable]['ctrl']['title']),
+								'--div--',
+								$icon
+							);
+						}
+						// Add help text
+						$helpText = array();
+						$languageService->loadSingleTableDescription($theTable);
+						$helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theFullField];
+						if (!empty($helpTextArray['description'])) {
+							$helpText['description'] = $helpTextArray['description'];
+						}
+						// Item configuration:
+						$items[] = array(
+							rtrim($languageService->sL($GLOBALS['TCA'][$theTable]['columns'][$theField]['label']), ':') . ' (' . $theField . ')',
+							$theTypeArrays[1],
+							'empty-empty',
+							$helpText
+						);
+					}
+					break;
+				case 'explicitValues':
+					$theTypes = BackendUtility::getExplicitAuthFieldValues();
+					// Icons:
+					$icons = array(
+						'ALLOW' => 'status-status-permission-granted',
+						'DENY' => 'status-status-permission-denied'
+					);
+					// Traverse types:
+					foreach ($theTypes as $tableFieldKey => $theTypeArrays) {
+						if (is_array($theTypeArrays['items'])) {
+							// Add header:
+							$items[] = array(
+								$theTypeArrays['tableFieldLabel'],
+								'--div--'
+							);
+							// Traverse options for this field:
+							foreach ($theTypeArrays['items'] as $itemValue => $itemContent) {
+								// Add item to be selected:
+								$items[] = array(
+									'[' . $itemContent[2] . '] ' . $itemContent[1],
+									$tableFieldKey . ':' . preg_replace('/[:|,]/', '', $itemValue) . ':' . $itemContent[0],
+									$icons[$itemContent[0]]
+								);
+							}
+						}
+					}
+					break;
+				case 'languages':
+					$items = array_merge($items, BackendUtility::getSystemLanguages());
+					break;
+				case 'custom':
+					// Initialize:
+					$customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
+					if (is_array($customOptions)) {
+						foreach ($customOptions as $coKey => $coValue) {
+							if (is_array($coValue['items'])) {
+								// Add header:
+								$items[] = array(
+									$languageService->sL($coValue['header']),
+									'--div--'
+								);
+								// Traverse items:
+								foreach ($coValue['items'] as $itemKey => $itemCfg) {
+									// Icon:
+									if ($itemCfg[1]) {
+										list($icon) = FormEngineUtility::getIcon($itemCfg[1]);
+									} else {
+										$icon = 'empty-empty';
+									}
+									// Add help text
+									$helpText = array();
+									if (!empty($itemCfg[2])) {
+										$helpText['description'] = $languageService->sL($itemCfg[2]);
+									}
+									// Add item to be selected:
+									$items[] = array(
+										$languageService->sL($itemCfg[0]),
+										$coKey . ':' . preg_replace('/[:|,]/', '', $itemKey),
+										$icon,
+										$helpText
+									);
+								}
+							}
+						}
+					}
+					break;
+				case 'modListGroup':
+
+				case 'modListUser':
+					$loadModules = GeneralUtility::makeInstance(ModuleLoader::class);
+					$loadModules->load($GLOBALS['TBE_MODULES']);
+					$modList = $fieldValue['config']['special'] == 'modListUser' ? $loadModules->modListUser : $loadModules->modListGroup;
+					if (is_array($modList)) {
+						foreach ($modList as $theMod) {
+							// Icon:
+							$icon = $languageService->moduleLabels['tabs_images'][$theMod . '_tab'];
+							if ($icon) {
+								$icon = '../' . PathUtility::stripPathSitePrefix($icon);
+							}
+							// Add help text
+							$helpText = array(
+								'title' => $languageService->moduleLabels['labels'][$theMod . '_tablabel'],
+								'description' => $languageService->moduleLabels['labels'][$theMod . '_tabdescr']
+							);
+
+							$label = '';
+							// Add label for main module:
+							$pp = explode('_', $theMod);
+							if (count($pp) > 1) {
+								$label .= $languageService->moduleLabels['tabs'][($pp[0] . '_tab')] . '>';
+							}
+							// Add modules own label now:
+							$label .= $languageService->moduleLabels['tabs'][$theMod . '_tab'];
+
+							// Item configuration:
+							$items[] = array($label, $theMod, $icon, $helpText);
+						}
+					}
+					break;
+			}
+		}
+
+		return $items;
+	}
+
+	/**
+	 * Adds records from a foreign table (for selector boxes). Helper for addSelectOptionsToItemArray()
+	 *
+	 * @param array $items The array of items (label,value,icon)
+	 * @param array $fieldValue The 'columns' array for the field (from TCA)
+	 * @param array $TSconfig TSconfig for the table/row
+	 * @param string $field The fieldname
+	 * @param bool $pFFlag If set, then we are fetching the 'neg_' foreign tables.
+	 * @return array The $items array modified.
+	 */
+	static protected function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = FALSE) {
+		$languageService = static::getLanguageService();
+		$db = static::getDatabaseConnection();
+
+		// Init:
+		$pF = $pFFlag ? 'neg_' : '';
+		$f_table = $fieldValue['config'][$pF . 'foreign_table'];
+		$uidPre = $pFFlag ? '-' : '';
+		// Exec query:
+		$res = BackendUtility::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
+		// Perform error test
+		if ($db->sql_error()) {
+			$msg = htmlspecialchars($db->sql_error());
+			$msg .= '<br />' . LF;
+			$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(FlashMessage::class, $msg, $msgTitle, FlashMessage::ERROR, TRUE);
+			/** @var $flashMessageService FlashMessageService */
+			$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+			/** @var $defaultFlashMessageQueue FlashMessageQueue */
+			$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+			$defaultFlashMessageQueue->enqueue($flashMessage);
+			return array();
+		}
+		// Get label 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']);
+		// Traverse the selected rows to add them:
+		while ($row = $db->sql_fetch_assoc($res)) {
+			BackendUtility::workspaceOL($f_table, $row);
+			if (is_array($row)) {
+				// Prepare the icon if available:
+				if ($iField && $iPath && $row[$iField]) {
+					$iParts = GeneralUtility::trimExplode(',', $row[$iField], TRUE);
+					$icon = '../' . $iPath . '/' . trim($iParts[0]);
+				} elseif (GeneralUtility::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
+					$icon = IconUtility::mapRecordTypeToSpriteIconName($f_table, $row);
+				} else {
+					$icon = '';
+				}
+				// Add the item:
+				$items[] = array(
+					$lPrefix . htmlspecialchars(BackendUtility::getRecordTitle($f_table, $row)),
+					$uidPre . $row['uid'],
+					$icon
+				);
+			}
+		}
+		$db->sql_free_result($res);
+		return $items;
+	}
+
+	/**
+	 * @return LanguageService
+	 */
+	static protected function  getLanguageService() {
+		return $GLOBALS['LANG'];
+	}
+
+	/**
+	 * @return DatabaseConnection
+	 */
+	static protected function getDatabaseConnection() {
+		return $GLOBALS['TYPO3_DB'];
+	}
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php
similarity index 91%
rename from typo3/sysext/backend/Classes/Form/Element/SuggestElement.php
rename to typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php
index 13cca3894a5de7712c4213fdf022242851292363..9ea5e0f5f07e850f9405255895ff4cdce91d834d 100644
--- a/typo3/sysext/backend/Classes/Form/Element/SuggestElement.php
+++ b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Backend\Form\Element;
+namespace TYPO3\CMS\Backend\Form\Wizard;
 
 /*
  * This file is part of the TYPO3 CMS project.
@@ -18,39 +18,20 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver;
 
 /**
- * TCEforms wizard for rendering an AJAX selector for records
+ * Wizard for rendering an AJAX selector for records
  *
  * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
  * @author Benjamin Mack <benni@typo3.org>
  */
-class SuggestElement {
-
-	/**
-	 * @var int Count the number of ajax selectors used
-	 */
-	public $suggestCount = 0;
+class SuggestWizard {
 
 	/**
 	 * @var string
 	 */
-	public $cssClass = 'typo3-TCEforms-suggest';
-
-	/**
-	 * @var \TYPO3\CMS\Backend\Form\FormEngine
-	 */
-	public $TCEformsObj;
-
-	/**
-	 * Initialize an instance of SuggestElement
-	 *
-	 * @param \TYPO3\CMS\Backend\Form\FormEngine $tceForms Reference to an TCEforms instance
-	 * @return void
-	 */
-	public function init($tceForms) {
-		$this->TCEformsObj = $tceForms;
-	}
+	protected $cssClass = 'typo3-TCEforms-suggest';
 
 	/**
 	 * Renders an ajax-enabled text field. Also adds required JS
@@ -64,7 +45,6 @@ class SuggestElement {
 	 */
 	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'];
 		$isFlexFormField = $GLOBALS['TCA'][$table]['columns'][$field]['config']['type'] === 'flex';
@@ -113,9 +93,12 @@ class SuggestElement {
 
 		// Replace "-" with ucwords for the JS object name
 		$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($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord')) . '";' . LF;
+		$selector .=
+			'<script type="text/javascript">' . LF .
+				'var ' . $jsObj . ' = new TCEForms.Suggest("' . $fieldname . '", "' . $table . '", "' . $field . '", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ', "' . $type . '", ' . GeneralUtility::quoteJSvalue($jsRow) . ');' . LF .
+				$jsObj . '.defaultValue = "' . GeneralUtility::slashJS($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.findRecord')) . '";' . LF .
+			'</script>' . LF;
+
 		return $selector;
 	}
 
@@ -278,7 +261,7 @@ class SuggestElement {
 			// instantiate the class that should fetch the records for this $queryTable
 			$receiverClassName = $config['receiverClass'];
 			if (!class_exists($receiverClassName)) {
-				$receiverClassName = \TYPO3\CMS\Backend\Form\Element\SuggestDefaultReceiver::class;
+				$receiverClassName = SuggestWizardDefaultReceiver::class;
 			}
 			$receiverObj = GeneralUtility::makeInstance($receiverClassName, $queryTable, $config);
 			$params = array('value' => $search);
diff --git a/typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php
similarity index 99%
rename from typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php
rename to typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php
index cc50e577a715cc3e7c557dcc4250e28ccf314616..82e06b38285cf59211c109b8bdd9f2218cb25b4a 100644
--- a/typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php
+++ b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Backend\Form\Element;
+namespace TYPO3\CMS\Backend\Form\Wizard;
 
 /*
  * This file is part of the TYPO3 CMS project.
@@ -28,7 +28,7 @@ use TYPO3\CMS\Lang\LanguageService;
  * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
  * @author Benjamin Mack <benni@typo3.org>
  */
-class SuggestDefaultReceiver {
+class SuggestWizardDefaultReceiver {
 
 	/**
 	 * The name of the table to query
diff --git a/typo3/sysext/backend/Classes/Form/Element/ValueSlider.php b/typo3/sysext/backend/Classes/Form/Wizard/ValueSliderWizard.php
similarity index 90%
rename from typo3/sysext/backend/Classes/Form/Element/ValueSlider.php
rename to typo3/sysext/backend/Classes/Form/Wizard/ValueSliderWizard.php
index b17ec018142e955cfc5c33366d0f4bf52a11bc7c..8e9b71ba857bb7d35faff27680d86300ba1732ee 100644
--- a/typo3/sysext/backend/Classes/Form/Element/ValueSlider.php
+++ b/typo3/sysext/backend/Classes/Form/Wizard/ValueSliderWizard.php
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Backend\Form\Element;
+namespace TYPO3\CMS\Backend\Form\Wizard;
 
 /*
  * This file is part of the TYPO3 CMS project.
@@ -17,21 +17,19 @@ namespace TYPO3\CMS\Backend\Form\Element;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
- * TCEforms wizard for rendering an AJAX selector for records
+ * Wizard for rendering an AJAX selector for records
  *
  * @author Steffen Kamper <steffen@typo3.org>
  */
-class ValueSlider {
+class ValueSliderWizard {
 
 	/**
 	 * Renders the slider value wizard
 	 *
 	 * @param array $params
-	 * @param \TYPO3\CMS\Backend\Form\FormEngine $pObj
 	 * @return string
 	 */
-	public function renderWizard(&$params, &$pObj) {
-		$pObj->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/ValueSlider.js');
+	public function renderWizard($params) {
 		$field = $params['field'];
 		$value = $params['row'][$field];
 		// If Slider is used in a flexform
diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
index afa8338009ee05d8032bc648dfea78d75b2bb2e4..0fcafd6042bd01e53be57f98b8436db23900ab6d 100644
--- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php
+++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
@@ -2504,8 +2504,7 @@ class BackendUtility {
 	 *******************************************/
 	/**
 	 * Returns help-text icon if configured for.
-	 * TCA_DESCR must be loaded prior to this function and static::getBackendUserAuthentication() must
-	 * have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned
+	 * TCA_DESCR must be loaded prior to this function
 	 *
 	 * Please note: since TYPO3 4.5 the UX team decided to not use CSH in its former way,
 	 * but to wrap the given text (where before the help icon was, and you could hover over it)
@@ -2521,10 +2520,7 @@ class BackendUtility {
 	 */
 	static public function helpTextIcon($table, $field, $BACK_PATH = '', $force = FALSE) {
 		GeneralUtility::logDeprecatedFunction();
-		if (
-			is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])
-			&& (isset(static::getBackendUserAuthentication()->uc['edit_showFieldHelp']) || $force)
-		) {
+		if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])) {
 			return self::wrapInHelp($table, $field);
 		}
 		return '';
diff --git a/typo3/sysext/backend/Classes/View/BackendLayoutView.php b/typo3/sysext/backend/Classes/View/BackendLayoutView.php
index 977dfc1fb214c75cb31ae41978cbf72a2034ee5b..9404b2cdd2c7ab94b657374754093c5af1b03d18 100644
--- a/typo3/sysext/backend/Classes/View/BackendLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/BackendLayoutView.php
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\View;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 
 /**
  * Backend layout for CMS
@@ -259,10 +260,8 @@ class BackendLayoutView implements \TYPO3\CMS\Core\SingletonInterface {
 	public function getColPosListItemsParsed($id) {
 		$tsConfig = BackendUtility::getModTSconfig($id, 'TCEFORM.tt_content.colPos');
 		$tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config'];
-		/** @var $tceForms \TYPO3\CMS\Backend\Form\FormEngine */
-		$tceForms = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormEngine::class);
 		$tcaItems = $tcaConfig['items'];
-		$tcaItems = $tceForms->addItems($tcaItems, $tsConfig['properties']['addItems.']);
+		$tcaItems = FormEngineUtility::addItems($tcaItems, $tsConfig['properties']['addItems.']);
 		if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) {
 			$tcaItems = $this->addColPosListLayoutItems($id, $tcaItems);
 		}
diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index accad4040ca4911f1ef1db079e954fc570901b52..9dfb5a160b9647940ec47628a9cbd7bcaa32c183 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -334,7 +334,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
 			// Traverse fields (as set above) in order to create header values:
 			foreach ($this->fieldArray as $field) {
 				if ($editIdList && isset($GLOBALS['TCA']['pages']['columns'][$field]) && $field != 'uid' && !$this->pages_noEditColumns) {
-					$params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=' . $field . '&disHelp=1';
+					$params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=' . $field;
 					$iTitle = sprintf(
 						$this->getLanguageService()->getLL('editThisColumn'),
 						rtrim(trim($this->getLanguageService()->sL(BackendUtility::getItemLabel('pages', $field))), ':')
diff --git a/typo3/sysext/backend/Migrations/Code/ClassAliasMap.php b/typo3/sysext/backend/Migrations/Code/ClassAliasMap.php
new file mode 100644
index 0000000000000000000000000000000000000000..607029dc82b088b95cc7c8eca33d11daf22216da
--- /dev/null
+++ b/typo3/sysext/backend/Migrations/Code/ClassAliasMap.php
@@ -0,0 +1,6 @@
+<?php
+return array(
+	\TYPO3\CMS\Backend\Form\Element\SuggestElement::class => \TYPO3\CMS\Backend\Form\Wizard\SuggestWizard::class,
+	\TYPO3\CMS\Backend\Form\Element\SuggestDefaultReceiver::class => \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver::class,
+	\TYPO3\CMS\Backend\Form\Element\ValueSlider::class => \TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard::class,
+);
diff --git a/typo3/sysext/backend/Tests/Unit/Form/Element/InlineElementTest.php b/typo3/sysext/backend/Tests/Unit/Form/Element/InlineElementTest.php
index 0fb68e0c684bc775e952ee3ae915195148b58003..3573a12d9ee981c4cc945f958adea5bee99c0ce9 100644
--- a/typo3/sysext/backend/Tests/Unit/Form/Element/InlineElementTest.php
+++ b/typo3/sysext/backend/Tests/Unit/Form/Element/InlineElementTest.php
@@ -14,12 +14,17 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Tests\UnitTestCase;
+use TYPO3\CMS\Backend\Form\Element\InlineElement;
+use TYPO3\CMS\Backend\Form\FormEngine;
+
 /**
- * Tests for Inline Relational Record Editing form rendering.
+ * Test case
  *
  * @author Oliver Hader <oliver.hader@typo3.org>
  */
-class InlineElementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
+class InlineElementTest extends UnitTestCase {
+
 	/**
 	 * @var \TYPO3\CMS\Backend\Form\Element\InlineElement
 	 */
@@ -29,9 +34,9 @@ class InlineElementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 	 * Sets up this test case.
 	 */
 	protected function setUp() {
-		// @todo Use $this->buildAccessibleProxy() if properties are protected
-		$this->subject = new \TYPO3\CMS\Backend\Form\Element\InlineElement();
-		$this->subject->fObj = $this->getMock(\TYPO3\CMS\Backend\Form\FormEngine::class, array(), array(), '', FALSE);
+		/** @var InlineElement|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface subject */
+		$this->subject = $this->getAccessibleMock(InlineElement::class, array('dummy'));
+		$this->subject->_set('formEngine', $this->getMock(FormEngine::class, array(), array(), '', FALSE));
 	}
 
 	/**
@@ -336,7 +341,7 @@ class InlineElementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 	public function checkFileTypeAccessForFieldForFieldNoFiletypesReturnsTrue(){
 		$selectorData = array();
 		$fileData['extension'] = 'png';
-		$mockObject = $this->getAccessibleMock(\TYPO3\CMS\Backend\Form\Element\InlineElement::class, array('dummy'));
+		$mockObject = $this->getAccessibleMock(InlineElement::class, array('dummy'));
 		$mayUploadFile = $mockObject->_call('checkFileTypeAccessForField', $selectorData, $fileData);
 		$this->assertTrue($mayUploadFile);
 	}
@@ -349,7 +354,7 @@ class InlineElementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 	public function checkFileTypeAccessForFieldFiletypesSetRecordTypeNotInListReturnsFalse(){
 		$selectorData['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'] = 'doc, png, jpg, tiff';
 		$fileData['extension'] = 'php';
-		$mockObject = $this->getAccessibleMock(\TYPO3\CMS\Backend\Form\Element\InlineElement::class, array('dummy'));
+		$mockObject = $this->getAccessibleMock(InlineElement::class, array('dummy'));
 		$mayUploadFile = $mockObject->_call('checkFileTypeAccessForField', $selectorData, $fileData);
 		$this->assertFalse($mayUploadFile);
 	}
@@ -362,7 +367,7 @@ class InlineElementTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 	public function checkFileTypeAccessForFieldFiletypesSetRecordTypeInListReturnsTrue(){
 		$selectorData['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'] = 'doc, png, jpg, tiff';
 		$fileData['extension'] = 'png';
-		$mockObject = $this->getAccessibleMock(\TYPO3\CMS\Backend\Form\Element\InlineElement::class, array('dummy'));
+		$mockObject = $this->getAccessibleMock(InlineElement::class, array('dummy'));
 		$mayUploadFile = $mockObject->_call('checkFileTypeAccessForField', $selectorData, $fileData);
 		$this->assertTrue($mayUploadFile);
 	}
diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormEngineTest.php b/typo3/sysext/backend/Tests/Unit/Form/Element/NoneElementTest.php
similarity index 91%
rename from typo3/sysext/backend/Tests/Unit/Form/FormEngineTest.php
rename to typo3/sysext/backend/Tests/Unit/Form/Element/NoneElementTest.php
index 0c5086f9e47c86d2f8fe029b80cbe2f3bab4ac54..1b1a24357eefd527309f7b21f6a61e538e120d1b 100644
--- a/typo3/sysext/backend/Tests/Unit/Form/FormEngineTest.php
+++ b/typo3/sysext/backend/Tests/Unit/Form/Element/NoneElementTest.php
@@ -15,23 +15,12 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form;
  */
 
 use TYPO3\CMS\Core\Tests\UnitTestCase;
+use TYPO3\CMS\Backend\Form\Element\NoneElement;
 
 /**
  * Test case
  */
-class FormEngineTest extends UnitTestCase {
-
-	/**
-	 * @var \TYPO3\CMS\Backend\Form\FormEngine|\PHPUnit_Framework_MockObject_MockObject
-	 */
-	protected $subject;
-
-	/**
-	 * Sets up this test case.
-	 */
-	protected function setUp() {
-		$this->subject = $this->getMock(\TYPO3\CMS\Backend\Form\FormEngine::class, array('dummy'), array(), '', FALSE);
-	}
+class NoneElementTest extends UnitTestCase {
 
 	/**
 	 * @return array
@@ -250,9 +239,11 @@ class FormEngineTest extends UnitTestCase {
 	 * @test
 	 */
 	public function formatValueWithGivenConfiguration($config, $itemValue, $expectedResult) {
+		/** @var NoneElement|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
+		$subject = $this->getAccessibleMock(NoneElement::class, array('dummy'), array(), '', FALSE);
 		$timezoneBackup = date_default_timezone_get();
 		date_default_timezone_set('UTC');
-		$result = $this->subject->formatValue($config, $itemValue);
+		$result = $subject->_call('formatValue', $config, $itemValue);
 		date_default_timezone_set($timezoneBackup);
 
 		$this->assertEquals($expectedResult, $result);
diff --git a/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php b/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
index d98c66cf3dac54bcf432a5f732ed253799032952..18a9c1854b26457afd2c148f04c67c5ec5924605 100644
--- a/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
+++ b/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
@@ -57,10 +57,10 @@ return array(
 	't3lib_TCEforms' => \TYPO3\CMS\Backend\Form\FormEngine::class,
 	't3lib_TCEforms_FE' => \TYPO3\CMS\Backend\Form\FrontendFormEngine::class,
 	't3lib_TCEforms_dbFileIconsHook' => \TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface::class,
-	't3lib_TCEforms_Suggest' => \TYPO3\CMS\Backend\Form\Element\SuggestElement::class,
-	't3lib_TCEforms_Suggest_DefaultReceiver' => \TYPO3\CMS\Backend\Form\Element\SuggestDefaultReceiver::class,
+	't3lib_TCEforms_Suggest' => \TYPO3\CMS\Backend\Form\Wizard\SuggestWizard::class,
+	't3lib_TCEforms_Suggest_DefaultReceiver' => \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver::class,
 	't3lib_TCEforms_Tree' => \TYPO3\CMS\Backend\Form\Element\TreeElement::class,
-	't3lib_TCEforms_ValueSlider' => \TYPO3\CMS\Backend\Form\Element\ValueSlider::class,
+	't3lib_TCEforms_ValueSlider' => \TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard::class,
 	't3lib_TCEforms_Flexforms' => \TYPO3\CMS\Backend\Form\FlexFormsHelper::class,
 	't3lib_tsfeBeUserAuth' => \TYPO3\CMS\Backend\FrontendBackendUserAuthentication::class,
 	'recordHistory' => \TYPO3\CMS\Backend\History\RecordHistory::class,
diff --git a/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php b/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
index 23790f8dd8db97bfa302050258fb5542f3ce2a49..9cfe6c8f1b49f46c89baad021886ee8c2745eaee 100644
--- a/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
+++ b/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
@@ -294,12 +294,12 @@ interface t3lib_TCEforms_dbFileIconsHook extends \TYPO3\CMS\Backend\Form\Databas
 /**
  * @deprecated since 6.0, removed since 7.0
  */
-class t3lib_TCEforms_Suggest extends \TYPO3\CMS\Backend\Form\Element\SuggestElement {}
+class t3lib_TCEforms_Suggest extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizard {}
 
 /**
  * @deprecated since 6.0, removed since 7.0
  */
-class t3lib_TCEforms_Suggest_DefaultReceiver extends \TYPO3\CMS\Backend\Form\Element\SuggestDefaultReceiver {}
+class t3lib_TCEforms_Suggest_DefaultReceiver extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver {}
 
 /**
  * @deprecated since 6.0, removed since 7.0
@@ -309,7 +309,7 @@ class t3lib_TCEforms_Tree extends \TYPO3\CMS\Backend\Form\Element\TreeElement {}
 /**
  * @deprecated since 6.0, removed since 7.0
  */
-class t3lib_TCEforms_ValueSlider extends \TYPO3\CMS\Backend\Form\Element\ValueSlider {}
+class t3lib_TCEforms_ValueSlider extends \TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard {}
 
 /**
  * @deprecated since 6.0, removed since 7.0
diff --git a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
index 70439dc24109b02325442dc458cfc4e97f82ea2f..58690847c358f89b8d8a5795690f590c50ba9e38 100644
--- a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
+++ b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
@@ -308,7 +308,6 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
 		'startModule' => 'help_AboutmodulesAboutmodules',
 		'hideSubmoduleIcons' => 0,
 		'titleLen' => 50,
-		'edit_showFieldHelp' => 'icon',
 		'edit_RTE' => '1',
 		'edit_docModuleUpload' => '1',
 		'navFrameWidth' => '',
diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php
index b2a78c47acae96fefd036f3aa2c6bef47b0ee190..746d5e28c78bf6165d521c6671cb6816dc6c2912 100644
--- a/typo3/sysext/core/Configuration/DefaultConfiguration.php
+++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php
@@ -626,7 +626,7 @@ return array(
 				'csrfTokenCheck' => TRUE
 			),
 			't3lib_TCEforms_suggest::searchRecord' => array(
-				'callbackMethod' => \TYPO3\CMS\Backend\Form\Element\SuggestElement::class . '->processAjaxRequest',
+				'callbackMethod' => \TYPO3\CMS\Backend\Form\Wizard\SuggestWizard::class . '->processAjaxRequest',
 				'csrfTokenCheck' => TRUE
 			),
 			'ShortcutMenu::getShortcutEditForm' => array(
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-65357-DependenciesToFormEngine.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65357-DependenciesToFormEngine.rst
new file mode 100644
index 0000000000000000000000000000000000000000..07c8bb228f678fc1cb72ca5705600672823dea96
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65357-DependenciesToFormEngine.rst
@@ -0,0 +1,104 @@
+=============================================
+Breaking: #65357 - Dependencies to FormEngine
+=============================================
+
+Description
+===========
+
+A bigger refactoring of FormEngine classes and its sub classes broke a number
+of pubic properties and a couple of methods of the FormEngine class.
+
+Ignored properties
+------------------
+
+FormEngine->$defaultInputWidth
+FormEngine->$minimumInputWidth
+FormEngine->$maxInputWidth
+FormEngine->$form_largeComp
+FormEngine->$form_rowsToStylewidth
+FormEngine->$defaultMultipleSelectorStyle
+FormEngine->$charsPerRow
+FormEngine->$RTEenabled_notReasons
+FormEngine->$RTEenabled
+FormEngine->$disableRTE
+FormEngine->$backPath
+FormEngine->$formName
+FormEngine->$palFieldArr
+FormEngine->$commentMessages
+FormEngine->$edit_docModuleUpload
+FormEngine->$isPalettedoc
+FormEngine->$paletteMargin
+FormEngine->$cachedTSconfig_fieldLevel
+FormEngine->$transformedRow
+FormEngine->$globalShowHelp
+FormEngine->$doPrintPalette
+FormEngine->$enableClickMenu
+FormEngine->$enableTabMenu
+FormEngine->$form_additionalTextareaStyleWidth
+FormEngine->$edit_showFieldHelp
+FormEngine->$clientInfo
+FormEngine->$savedSchemes
+FormEngine->$additionalJS_pre
+FormEngine->$cachedTSconfig
+FormEngine->$defaultLanguageData
+FormEngine->$printNeededJS
+FormEngine->$clipObj
+EditDocumentController->$disHelp
+InlineElement->$fObj
+SuggestElement->$suggestCount
+SuggestElement->$TCEformsObj
+DataPreprocessor->$disableRTE
+
+Other property changes
+----------------------
+
+FormEngine->$allowOverrideMatrix is now protected
+SuggestElement->class is now protected
+
+
+Changed user functions and hooks
+--------------------------------
+
+TCA: If format of type=none is set to user, the configured userFunc no longer gets an instance of FormEngine
+as parent object, but an instance of NoneElement.
+
+TCA: Wizards configured as "userFunc" now receive a dummy FormEngine object with empty properties instead
+of the real instance.
+
+
+Breaking methods
+----------------
+
+FormEngine->renderWizards()
+FormEngine->dbFileIcons()
+FormEngine->getClipboardElements()
+SuggestElement->init()
+
+Breaking interface changes
+--------------------------
+
+The type hint to FormEngine as $pObj had to be removed on the DatabaseFileIconsHookInterface.
+This hook is no longer given an instance of FormEngine.
+
+
+Impact
+======
+
+Affected properties are removed or deprecated and have no effect anymore. This
+shouldn't be a big problem in most cases since most properties were for internal
+handling.
+
+Affected methods will throw an exception and stop working in case they are called.
+
+
+Affected installations
+======================
+
+Instances with extensions that operate on TYPO3\CMS\Backend\Form\FormEngine
+are likely to be affected.
+
+
+Migration
+=========
+
+Refactor calling code to not use those methods anymore.
\ No newline at end of file
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65357-DependenciesToFormEngine.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65357-DependenciesToFormEngine.rst
new file mode 100644
index 0000000000000000000000000000000000000000..77f00d8b4f0defe609f2d355e02519cf40738da4
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65357-DependenciesToFormEngine.rst
@@ -0,0 +1,60 @@
+================================================
+Deprecation: #65357 - Dependencies to FormEngine
+================================================
+
+Description
+===========
+
+A bigger refactoring of FormEngine classes and its sub classes deprecated
+a number of properties and methods.
+
+Deprecated methods
+------------------
+
+FormEngine->getSingleField_typeNone_render()
+FormEngine->formMaxWidth()
+FormEngine->elName()
+FormEngine->formatValue()
+FormEngine->procItems()
+FormEngine->getIcon()
+FormEngine->getIconHtml()
+FormEngine->initItemArray()
+FormEngine->addItems()
+FormEngine->setTSconfig()
+FormEngine->addSelectOptionsToItemArray()
+FormEngine->addSelectOptionsToItemArray_makeModuleData()
+FormEngine->foreignTable()
+FormEngine->optionTagStyle()
+FormEngine->extractValuesOnlyFromValueLabelList()
+FormEngine->overrideFieldConf()
+FormEngine->getLanguageIcon()
+FormEngine->getClickMenu()
+EditDocumentController->tceformMessages()
+
+Renamed classes
+---------------
+
+\TYPO3\CMS\Backend\Form\Element\SuggestElement renamed to \TYPO3\CMS\Backend\Form\Wizard\SuggestWizard
+\TYPO3\CMS\Backend\Form\Element\SuggestDefaultReceiver renamed to \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver
+\TYPO3\CMS\Backend\Form\Element\VaueSlider renamed to \TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard
+
+
+Impact
+======
+
+Methods listed here will still work, but are deprecated.
+
+
+Affected installations
+======================
+
+Instances with extensions that operate on TYPO3\CMS\Backend\Form\FormEngine
+are likely to be affected.
+
+
+Migration
+=========
+
+Methods listed here are moved around to different classes or fully obsolete.
+Take a look at the deprecation notices within the class structure to find
+out on how to adapt code.
\ No newline at end of file
diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index f01daa9ac00e6039772e056b30a744193fd2a234..00577e4b93217d463ce6f23484664c330f6d7364 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -892,7 +892,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
 						// The "edit marked" link:
 						$editIdList = implode(',', $currentIdList);
 						$editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
-						$params = '&edit[' . $table . '][' . $editIdList . ']=edit&disHelp=1';
+						$params = '&edit[' . $table . '][' . $editIdList . ']=edit';
 						$onClick = htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1));
 						$cells['edit'] = '<a class="btn btn-default" href="#" onclick="' . $onClick . '" title="'
 							. $lang->getLL('clip_editMarked', TRUE) . '">'
@@ -970,7 +970,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
 							if ($this->clipNumPane()) {
 								$editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
 							}
-							$params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
+							$params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray);
 							$icon .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1))
 								. '" title="' . $lang->getLL('editShownColumns', TRUE) . '">'
 								. IconUtility::getSpriteIcon('actions-document-open') . '</a>';
@@ -1010,7 +1010,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
 							if ($this->clipNumPane()) {
 								$editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
 							}
-							$params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
+							$params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol;
 							$iTitle = sprintf($lang->getLL('editThisColumn'), $sortLabel);
 							$theData[$fCol] .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1))
 								. '" title="' . htmlspecialchars($iTitle) . '">'
diff --git a/typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php b/typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php
index 48d4d31c85d1e9b18c151ecd76275ab1a460d69f..b97319e9ca66f6d311c80591823c4feed8519e69 100644
--- a/typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php
+++ b/typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php
@@ -212,7 +212,7 @@ class FrontendRteController extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase {
 		// Register RTE in JS
 		$this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '', $textAreaId));
 		// Set the save option for the RTE:
-		$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
+		$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, 'editform', $textAreaId);
 		$this->pageRenderer->loadRequireJs();
 		// Loading ExtJs JavaScript files and inline code, if not configured in TS setup
 		if (!is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) {
diff --git a/typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php b/typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php
index b38614ce815f244b8137cfaf532cfa5023a91f97..fa04b76a4df49f46ca3ba4c8cccf59c232c54d58 100644
--- a/typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php
+++ b/typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php
@@ -344,8 +344,6 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
 			 * INIT THE EDITOR-SETTINGS
 			 * =======================================
 			 */
-			// Set backPath
-			$this->backPath = $this->TCEform->backPath;
 			// Get the path to this extension:
 			$this->extHttpPath = $this->backPath . ExtensionManagementUtility::extRelPath($this->ID);
 			// Get the site URL
@@ -467,8 +465,8 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
 			// Register RTE in JS
 			$this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field, $textAreaId);
 			// Set the save option for the RTE
-			$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId, $PA['itemFormElName']);
-			$this->TCEform->additionalJS_delete[] = $this->setDeleteRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
+			$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, 'editform', $textAreaId, $PA['itemFormElName']);
+			$this->TCEform->additionalJS_delete[] = $this->setDeleteRTE($this->TCEform->RTEcounter, 'editform', $textAreaId);
 			// Loading ExtJs inline code
 			$this->pageRenderer->enableExtJSQuickTips();
 			// Add TYPO3 notifications JavaScript
diff --git a/typo3/sysext/sys_action/Classes/ActionTask.php b/typo3/sysext/sys_action/Classes/ActionTask.php
index 6127434d286b745a306601ba15f5d7aeaae67731..e63698fbdc94cda429bb6e07455a0ffccb27e14e 100644
--- a/typo3/sysext/sys_action/Classes/ActionTask.php
+++ b/typo3/sysext/sys_action/Classes/ActionTask.php
@@ -30,11 +30,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
 	 */
 	protected $taskObject;
 
-	/**
-	 * @var \TYPO3\CMS\Backend\Form\FormEngine
-	 */
-	public $t3lib_TCEforms;
-
 	/**
 	 * All hook objects get registered here for later use
 	 *
@@ -272,9 +267,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
 				$vars = $rawRecord;
 			}
 		}
-		$this->JScode();
-		$loadDB = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
-		$loadDB->start($vars['db_mountpoints'], 'pages');
 		$content .= '<form action="" method="post" enctype="multipart/form-data">
 						<fieldset class="fields">
 							<legend>' . $this->getLanguageService()->getLL('action_t1_legend_generalFields') . '</legend>
@@ -308,10 +300,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
 									' . $this->getUsergroups($record, $vars) . '
 								</select>
 							</div>
-							<div class="row">
-								<label for="field_db_mountpoints">' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tca.xlf:be_users.options_db_mounts') . '</label>
-								' . $this->t3lib_TCEforms->dbFileIcons('data[db_mountpoints]', 'db', 'pages', $loadDB->itemArray, '', array('size' => 3)) . '
-							</div>
 							<div class="row">
 								<input type="hidden" name="data[key]" value="' . $key . '" />
 								<input type="hidden" name="data[sent]" value="1" />
@@ -562,17 +550,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
 		return $access;
 	}
 
-	/**
-	 * Add additional JavaScript to use the tceform select box
-	 *
-	 * @return void
-	 */
-	protected function JScode() {
-		$this->t3lib_TCEforms = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormEngine::class);
-		$this->t3lib_TCEforms->backPath = $GLOBALS['BACK_PATH'];
-		$this->t3lib_TCEforms->printNeededJSFunctions();
-	}
-
 	/**
 	 * Create a user directory if defined
 	 *
diff --git a/typo3/sysext/t3editor/Classes/FormWizard.php b/typo3/sysext/t3editor/Classes/FormWizard.php
index 3464e80933be9827dbee08ae95d58235420dc77b..056f0d62858bf638268c901c2da3d69aab678454 100644
--- a/typo3/sysext/t3editor/Classes/FormWizard.php
+++ b/typo3/sysext/t3editor/Classes/FormWizard.php
@@ -42,9 +42,14 @@ class FormWizard {
 		$doc = $GLOBALS['SOBE']->doc;
 		$attributes = 'rows="' . $config['rows'] . '" ' . 'cols="' . $config['cols'] . '" ' . 'wrap="off" ' . 'style="' . $config['wizards']['t3editor']['params']['style'] . '" ' . 'onchange="' . $parameters['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] . '" ';
 		$parameters['item'] = '';
-		$parameters['item'] .= $t3editor->getCodeEditor($parameters['itemName'], 'text-monospace enable-tab', $parameters['row'][$parameters['field']], $attributes, $parameters['table'] . ' > ' . $parameters['field'], array(
-			'target' => (int)$pObj->target
-		));
+		$parameters['item'] .= $t3editor->getCodeEditor(
+			$parameters['itemName'],
+			'text-monospace enable-tab',
+			$parameters['row'][$parameters['field']],
+			$attributes,
+			$parameters['table'] . ' > ' . $parameters['field'],
+			array('target' => 0)
+		);
 		$parameters['item'] .= $t3editor->getJavascriptCode($doc);
 		return '';
 	}