2 namespace TYPO3\CMS\Backend\Form\Element
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Backend\Utility\BackendUtility
;
18 use TYPO3\CMS\Backend\Utility\IconUtility
;
19 use TYPO3\CMS\Core\Utility\GeneralUtility
;
22 * Generation of TCEform elements of the type "flexform"
24 class FlexElement
extends AbstractFormElement
{
27 * Handler for Flex Forms
29 * @param string $table The table name of the record
30 * @param string $field The field name which this element is supposed to edit
31 * @param array $row The record data array where the value(s) for the field can be found
32 * @param array $additionalInformation An array with additional configuration options.
33 * @return string The HTML code for the TCEform field
35 public function render($table, $field, $row, &$additionalInformation) {
37 $dataStructArray = BackendUtility
::getFlexFormDS($additionalInformation['fieldConf']['config'], $row, $table, $field);
39 // Manipulate Flexform DS via TSConfig and group access lists
40 if (is_array($dataStructArray)) {
41 $flexFormHelper = GeneralUtility
::makeInstance(\TYPO3\CMS\Backend\Form\FlexFormsHelper
::class);
42 $dataStructArray = $flexFormHelper->modifyFlexFormDS($dataStructArray, $table, $field, $row, $additionalInformation['fieldConf']);
43 unset($flexFormHelper);
45 // Get data structure:
46 if (is_array($dataStructArray)) {
48 $xmlData = $additionalInformation['itemFormElValue'];
49 $xmlHeaderAttributes = GeneralUtility
::xmlGetHeaderAttribs($xmlData);
50 $storeInCharset = strtolower($xmlHeaderAttributes['encoding']);
51 if ($storeInCharset) {
52 $currentCharset = $this->getLanguageService()->charSet
;
53 $xmlData = $this->getLanguageService()->csConvObj
->conv($xmlData, $storeInCharset, $currentCharset, 1);
55 $editData = GeneralUtility
::xml2array($xmlData);
56 // Must be XML parsing error...
57 if (!is_array($editData)) {
59 } elseif (!isset($editData['meta']) ||
!is_array($editData['meta'])) {
60 $editData['meta'] = array();
62 // Find the data structure if sheets are found:
63 $sheet = $editData['meta']['currentSheetId'] ?
$editData['meta']['currentSheetId'] : 'sDEF';
65 // Create language menu:
66 $langChildren = $dataStructArray['meta']['langChildren'] ?
1 : 0;
67 $langDisabled = $dataStructArray['meta']['langDisable'] ?
1 : 0;
68 $editData['meta']['currentLangId'] = array();
69 // Look up page overlays:
70 $checkPageLanguageOverlay = $this->getBackendUserAuthentication()->getTSConfigVal('options.checkPageLanguageOverlay') ?
TRUE : FALSE;
71 if ($checkPageLanguageOverlay) {
72 $where_clause = 'pid=' . (int)$row['pid'] . BackendUtility
::deleteClause('pages_language_overlay')
73 . BackendUtility
::versioningPlaceholderClause('pages_language_overlay');
74 $pageOverlays = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'pages_language_overlay', $where_clause, '', '', '', 'sys_language_uid');
76 $languages = $this->formEngine
->getAvailableLanguages();
77 foreach ($languages as $lInfo) {
79 $this->getBackendUserAuthentication()->checkLanguageAccess($lInfo['uid'])
80 && (!$checkPageLanguageOverlay ||
$lInfo['uid'] <= 0 ||
is_array($pageOverlays[$lInfo['uid']]))
82 $editData['meta']['currentLangId'][] = $lInfo['ISOcode'];
85 if (!is_array($editData['meta']['currentLangId']) ||
!count($editData['meta']['currentLangId'])) {
86 $editData['meta']['currentLangId'] = array('DEF');
88 $editData['meta']['currentLangId'] = array_unique($editData['meta']['currentLangId']);
89 $additionalInformation['_noEditDEF'] = FALSE;
90 if ($langChildren ||
$langDisabled) {
91 $rotateLang = array('DEF');
93 if (!in_array('DEF', $editData['meta']['currentLangId'])) {
94 array_unshift($editData['meta']['currentLangId'], 'DEF');
95 $additionalInformation['_noEditDEF'] = TRUE;
97 $rotateLang = $editData['meta']['currentLangId'];
100 if (is_array($dataStructArray['sheets'])) {
101 $tabsToTraverse = array_keys($dataStructArray['sheets']);
103 $tabsToTraverse = array($sheet);
106 $this->getControllerDocumentTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/FormEngineFlexForm');
108 /** @var $elementConditionMatcher \TYPO3\CMS\Backend\Form\ElementConditionMatcher */
109 $elementConditionMatcher = GeneralUtility
::makeInstance(\TYPO3\CMS\Backend\Form\ElementConditionMatcher
::class);
111 foreach ($rotateLang as $lKey) {
112 if (!$langChildren && !$langDisabled) {
113 $item .= '<strong>' . $this->formEngine
->getLanguageIcon($table, $row, ('v' . $lKey)) . $lKey . ':</strong>';
115 // Default language, other options are "lUK" or whatever country code (independent of system!!!)
119 foreach ($tabsToTraverse as $sheet) {
120 list($dataStruct, $sheet) = GeneralUtility
::resolveSheetDefInDS($dataStructArray, $sheet);
121 // If sheet has displayCond
122 if ($dataStruct['ROOT']['TCEforms']['displayCond']) {
123 $splitCondition = GeneralUtility
::trimExplode(':', $dataStruct['ROOT']['TCEforms']['displayCond']);
124 $skipCondition = FALSE;
126 switch ($splitCondition[0]) {
128 list($sheetName, $fieldName) = GeneralUtility
::trimExplode('.', $splitCondition[1]);
129 $fieldValue = $editData['data'][$sheetName][$lang][$fieldName];
130 $splitCondition[1] = $fieldName;
131 $dataStruct['ROOT']['TCEforms']['displayCond'] = join(':', $splitCondition);
132 $fakeRow = array($fieldName => $fieldValue);
134 case 'HIDE_FOR_NON_ADMINS':
138 case 'HIDE_L10N_SIBLINGS':
143 $fakeRow = array('uid' => $row['uid']);
146 $skipCondition = TRUE;
148 $displayConditionResult = TRUE;
149 if ($dataStruct['ROOT']['TCEforms']['displayCond']) {
150 $displayConditionResult = $elementConditionMatcher->match($dataStruct['ROOT']['TCEforms']['displayCond'], $fakeRow, 'vDEF');
152 // If sheets displayCond leads to false
153 if (!$skipCondition && !$displayConditionResult) {
154 // Don't create this sheet
159 if (is_array($dataStruct['ROOT']) && is_array($dataStruct['ROOT']['el'])) {
160 // Default language, other options are "lUK" or whatever country code (independent of system!!!)
161 $additionalInformation['_valLang'] = $langChildren && !$langDisabled ?
$editData['meta']['currentLangId'] : 'DEF';
162 $additionalInformation['_lang'] = $lang;
163 // Assemble key for loading the correct CSH file
164 $dsPointerFields = GeneralUtility
::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['ds_pointerField'], TRUE);
165 $additionalInformation['_cshKey'] = $table . '.' . $field;
166 foreach ($dsPointerFields as $key) {
167 $additionalInformation['_cshKey'] .= '.' . $row[$key];
169 // Push the sheet level tab to DynNestedStack
170 $tabIdentString = '';
171 if (is_array($dataStructArray['sheets'])) {
172 $tabIdentString = $this->getDocumentTemplate()->getDynTabMenuId('TCEFORMS:flexform:' . $additionalInformation['itemFormElName'] . $additionalInformation['_lang']);
173 $this->formEngine
->pushToDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) +
1));
176 $tRows = $this->getSingleField_typeFlex_draw($dataStruct['ROOT']['el'], $editData['data'][$sheet][$lang], $table, $field, $row, $additionalInformation, '[data][' . $sheet . '][' . $lang . ']');
177 $sheetContent = '<div class="typo3-TCEforms-flexForm t3-form-flexform">' . $tRows . '</div>';
178 // Pop the sheet level tab from DynNestedStack
179 if (is_array($dataStructArray['sheets'])) {
180 $this->formEngine
->popFromDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) +
1));
183 $sheetContent = 'Data Structure ERROR: No ROOT element found for sheet "' . $sheet . '".';
187 'label' => $dataStruct['ROOT']['TCEforms']['sheetTitle'] ?
$this->formEngine
->sL($dataStruct['ROOT']['TCEforms']['sheetTitle']) : $sheet,
188 'description' => $dataStruct['ROOT']['TCEforms']['sheetDescription'] ?
$this->formEngine
->sL($dataStruct['ROOT']['TCEforms']['sheetDescription']) : '',
189 'linkTitle' => $dataStruct['ROOT']['TCEforms']['sheetShortDescr'] ?
$this->formEngine
->sL($dataStruct['ROOT']['TCEforms']['sheetShortDescr']) : '',
190 'content' => $sheetContent
193 if (is_array($dataStructArray['sheets'])) {
194 $item .= $this->formEngine
->getDynTabMenu($tabParts, 'TCEFORMS:flexform:' . $additionalInformation['itemFormElName'] . $additionalInformation['_lang']);
196 $item .= $sheetContent;
200 $item = 'Data Structure ERROR: ' . $dataStructArray;
207 * Recursive rendering of flexforms
209 * @param array $dataStruct (part of) Data Structure for which to render. Keys on first level is flex-form fields
210 * @param array $editData (part of) Data array of flexform corresponding to the input DS. Keys on first level is flex-form field names
211 * @param string $table Table name, eg. tt_content
212 * @param string $field Field name, eg. tx_templavoila_flex
213 * @param array $row The particular record from $table in which the field $field is found
214 * @param array $PA Array of standard information for rendering of a form field in TCEforms, see other rendering functions too
215 * @param string $formPrefix Form field prefix, eg. "[data][sDEF][lDEF][...][...]
216 * @param int $level Indicates nesting level for the function call
217 * @param string $idPrefix Prefix for ID-values
218 * @param bool $toggleClosed Defines whether the next flexform level is open or closed. Comes from _TOGGLE pseudo field in FlexForm xml.
219 * @return string HTMl code for form.
221 public function getSingleField_typeFlex_draw($dataStruct, $editData, $table, $field, $row, &$PA, $formPrefix = '', $level = 0, $idPrefix = 'ID', $toggleClosed = FALSE) {
223 $mayRestructureFlexforms = $this->getBackendUserAuthentication()->checkLanguageAccess(0);
224 // Data Structure array must be ... and array of course...
225 if (is_array($dataStruct)) {
226 foreach ($dataStruct as $key => $value) {
227 // Traversing fields in structure:
228 if (is_array($value)) {
229 // The value of each entry must be an array.
230 // ********************
232 // ********************
234 // <title>LLL:EXT:cms/locallang_ttc.xml:media.sources</title>
235 $theTitle = $value['title'];
237 // If there is a title, check for LLL label
238 if (strlen($theTitle) > 0) {
239 $theTitle = htmlspecialchars(GeneralUtility
::fixed_lgd_cs($this->formEngine
->sL($theTitle),
240 (int)$this->getBackendUserAuthentication()->uc
['titleLen']));
242 // If it's a "section" or "container":
243 if ($value['type'] == 'array') {
244 // Creating IDs for form fields:
245 // It's important that the IDs "cascade" - otherwise we can't dynamically expand the flex form
246 // because this relies on simple string substitution of the first parts of the id values.
247 // This is a suffix used for forms on this level
248 $thisId = GeneralUtility
::shortMd5(uniqid('id', TRUE));
249 // $idPrefix is the prefix for elements on lower levels in the hierarchy and we combine this
250 // with the thisId value to form a new ID on this level.
251 $idTagPrefix = $idPrefix . '-' . $thisId;
252 // If it's a "section" containing other elements:
253 if ($value['section']) {
254 // Load script.aculo.us if flexform sections can be moved by drag'n'drop:
255 $this->getControllerDocumentTemplate()->getPageRenderer()->loadScriptaculous();
256 // Render header of section:
257 $output .= '<div class="t3-form-field-label-flexsection"><strong>' . $theTitle . '</strong></div>';
258 // Render elements in data array for section:
260 if (is_array($editData[$key]['el'])) {
261 foreach ($editData[$key]['el'] as $k3 => $v3) {
265 $theDat = $v3[$theType];
266 $newSectionEl = $value['el'][$theType];
267 if (is_array($newSectionEl)) {
268 $tRows[] = $this->getSingleField_typeFlex_draw(array($theType => $newSectionEl),
269 array($theType => $theDat), $table, $field, $row, $PA,
270 $formPrefix . '[' . $key . '][el][' . $cc . ']', $level +
1,
271 $idTagPrefix, $v3['_TOGGLE']);
276 // Now, we generate "templates" for new elements that could be added to this section
277 // by traversing all possible types of content inside the section:
278 // We have to handle the fact that requiredElements and such may be set during this
279 // rendering process and therefore we save and reset the state of some internal variables
280 // ... little crude, but works...
281 // Preserving internal variables we don't want to change:
282 $TEMP_requiredElements = $this->formEngine
->requiredElements
;
283 // Traversing possible types of new content in the section:
284 $newElementsLinks = array();
285 foreach ($value['el'] as $nnKey => $nCfg) {
286 $additionalJS_post_saved = $this->formEngine
->additionalJS_post
;
287 $this->formEngine
->additionalJS_post
= array();
288 $additionalJS_submit_saved = $this->formEngine
->additionalJS_submit
;
289 $this->formEngine
->additionalJS_submit
= array();
290 $newElementTemplate = $this->getSingleField_typeFlex_draw(array($nnKey => $nCfg),
291 array(), $table, $field, $row, $PA,
292 $formPrefix . '[' . $key . '][el][' . $idTagPrefix . '-form]', $level +
1,
294 // Makes a "Add new" link:
295 $var = str_replace('.', '', uniqid('idvar', TRUE));
296 $replace = 'replace(/' . $idTagPrefix . '-/g,"' . $idTagPrefix . '-"+' . $var . '+"-")';
297 $replace .= '.replace(/(tceforms-(datetime|date)field-)/g,"$1" + (new Date()).getTime())';
298 $onClickInsert = 'var ' . $var . ' = "' . 'idx"+(new Date()).getTime();'
299 // Do not replace $isTagPrefix in setActionStatus() because it needs section id!
300 . 'new Insertion.Bottom($("' . $idTagPrefix . '"), ' . json_encode($newElementTemplate)
301 . '.' . $replace . '); TYPO3.jQuery("#' . $idTagPrefix . '").t3FormEngineFlexFormElement();'
302 . 'eval(unescape("' . rawurlencode(implode(';', $this->formEngine
->additionalJS_post
)) . '").' . $replace . ');'
303 . 'TBE_EDITOR.addActionChecks("submit", unescape("'
304 . rawurlencode(implode(';', $this->formEngine
->additionalJS_submit
)) . '").' . $replace . ');'
305 . 'TYPO3.TCEFORMS.update();'
307 // Kasper's comment (kept for history):
308 // Maybe there is a better way to do this than store the HTML for the new element
309 // in rawurlencoded format - maybe it even breaks with certain charsets?
310 // But for now this works...
311 $this->formEngine
->additionalJS_post
= $additionalJS_post_saved;
312 $this->formEngine
->additionalJS_submit
= $additionalJS_submit_saved;
314 if (isset($nCfg['title'])) {
315 $title = $this->formEngine
->sL($nCfg['title']);
317 $newElementsLinks[] = '<a href="#" onclick="' . htmlspecialchars($onClickInsert) . '">'
318 . IconUtility
::getSpriteIcon('actions-document-new')
319 . htmlspecialchars(GeneralUtility
::fixed_lgd_cs($title, 30)) . '</a>';
321 // Reverting internal variables we don't want to change:
322 $this->formEngine
->requiredElements
= $TEMP_requiredElements;
323 // Adding the sections
325 // add the "toggle all" button for the sections
326 $toggleAll = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.toggleall', TRUE);
328 <div class="t3-form-field-toggle-flexsection t3-form-flexsection-toggle">
329 <a href="#">'. IconUtility
::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . '</a>
331 <div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsection t3-flex-container" data-t3-flex-allow-restructure="' . ($mayRestructureFlexforms ?
1 : 0) . '">' . implode('', $tRows) . '</div>';
333 // add the "new" link
334 if ($mayRestructureFlexforms) {
335 $output .= '<div class="t3-form-field-add-flexsection"><strong>'
336 . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.addnew', TRUE)
337 . ':</strong> ' . implode(' | ', $newElementsLinks) . '</div>';
340 $output = '<div class="t3-form-field-container t3-form-flex">' . $output . '</div>';
342 // It is a container of a single section
343 $toggleIconOpenState = ($toggleClosed ?
'display: none;' : '');
344 $toggleIconCloseState = (!$toggleClosed ?
'display: none;' : '');
346 $toggleIcons = IconUtility
::getSpriteIcon('actions-move-down', array('class' => 't3-flex-control-toggle-icon-open', 'style' => $toggleIconOpenState));
347 $toggleIcons .= IconUtility
::getSpriteIcon('actions-move-right', array('class' => 't3-flex-control-toggle-icon-close', 'style' => $toggleIconCloseState));
349 // Notice: Creating "new" elements after others seemed to be too difficult to do
350 // and since moving new elements created in the bottom is now so easy
351 // with drag'n'drop I didn't see the need.
352 // Putting together header of a section. Sections can be removed, copied, opened/closed, moved up and down:
353 // I didn't know how to make something right-aligned without a table, so I put it in a table.
354 // can be made into <div>'s if someone like to.
355 // Notice: The fact that I make a "Sortable.create" right onmousedown is that if we
356 // initialize this when rendering the form in PHP new and copied elements will not
357 // be possible to move as a sortable. But this way a new sortable is initialized every time
358 // someone tries to move and it will always work.
360 <div class="pull-left">
361 <a href="#" class="t3-flex-control-toggle-button">' . $toggleIcons . '</a>
362 <span class="t3-record-title">' . $theTitle . '</span>
365 if ($mayRestructureFlexforms) {
366 $ctrlHeader .= '<div class="pull-right">'
367 . IconUtility
::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move', 'class' => 't3-js-sortable-handle'))
368 . IconUtility
::getSpriteIcon('actions-edit-delete', array('title' => 'Delete', 'class' => 't3-delete'))
372 $ctrlHeader = '<div class="t3-form-field-header-flexsection t3-flex-section-header">' . $ctrlHeader . '</div>';
374 $s = GeneralUtility
::revExplode('[]', $formPrefix, 2);
375 $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1];
376 // Push the container to DynNestedStack as it may be toggled
377 $this->formEngine
->pushToDynNestedStack('flex', $idTagPrefix);
378 // Putting together the container:
379 $this->formEngine
->additionalJS_delete
= array();
380 $singleField_typeFlex_draw = $this->getSingleField_typeFlex_draw($value['el'],
381 $editData[$key]['el'], $table, $field, $row, $PA,
382 ($formPrefix . '[' . $key . '][el]'), ($level +
1), $idTagPrefix);
384 <div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsections t3-flex-section">
385 <input class="t3-flex-control t3-flex-control-action" type="hidden" name="' . htmlspecialchars($actionFieldName) . '" value=""/>
388 <div class="t3-form-field-record-flexsection t3-flex-section-content"'
389 . ($toggleClosed ?
' style="display:none;"' : '') . '>' . $singleField_typeFlex_draw . '
391 <input class="t3-flex-control t3-flex-control-toggle" id="' . $idTagPrefix . '-toggleClosed" type="hidden" name="'
392 . htmlspecialchars('data[' . $table . '][' . $row['uid'] . '][' . $field . ']' . $formPrefix . '[_TOGGLE]')
393 . '" value="' . ($toggleClosed ?
1 : 0) . '" />
395 $output = str_replace('/*###REMOVE###*/', GeneralUtility
::slashJS(htmlspecialchars(implode('', $this->formEngine
->additionalJS_delete
))), $output);
396 // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized"
397 // according to the data structure. It means that flexform XML will report unclean and
398 // a cleaning operation will remove the recorded togglestates. This is not a fatal problem.
399 // Ideally we should save the toggle states in meta-data but it is much harder to do that.
400 // And this implementation was easy to make and with no really harmful impact.
401 // Pop the container from DynNestedStack
402 $this->formEngine
->popFromDynNestedStack('flex', $idTagPrefix);
404 } elseif (is_array($value['TCEforms']['config'])) {
405 // Rendering a single form element:
406 if (is_array($PA['_valLang'])) {
407 $rotateLang = $PA['_valLang'];
409 $rotateLang = array($PA['_valLang']);
411 $conditionData = is_array($editData) ?
$editData : array();
412 // Add current $row to data processed by \TYPO3\CMS\Backend\Form\ElementConditionMatcher
413 $conditionData['parentRec'] = $row;
416 /** @var $elementConditionMatcher \TYPO3\CMS\Backend\Form\ElementConditionMatcher */
417 $elementConditionMatcher = GeneralUtility
::makeInstance(\TYPO3\CMS\Backend\Form\ElementConditionMatcher
::class);
419 foreach ($rotateLang as $vDEFkey) {
420 $vDEFkey = 'v' . $vDEFkey;
421 $displayConditionResult = TRUE;
422 if ($value['TCEforms']['displayCond']) {
423 $displayConditionResult = $elementConditionMatcher->match($value['TCEforms']['displayCond'], $conditionData, $vDEFkey);
425 if ($displayConditionResult) {
427 $fakePA['fieldConf'] = array(
428 'label' => $this->formEngine
->sL(trim($value['TCEforms']['label'])),
429 'config' => $value['TCEforms']['config'],
430 'defaultExtras' => $value['TCEforms']['defaultExtras'],
431 'onChange' => $value['TCEforms']['onChange']
433 if ($PA['_noEditDEF'] && $PA['_lang'] === 'lDEF') {
434 $fakePA['fieldConf']['config'] = array(
440 $fakePA['fieldConf']['onChange'] === 'reload'
441 ||
!empty($GLOBALS['TCA'][$table]['ctrl']['type'])
442 && (string)$key === $GLOBALS['TCA'][$table]['ctrl']['type']
443 ||
!empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'])
444 && GeneralUtility
::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $key)
446 if ($this->getBackendUserAuthentication()->jsConfirmation(1)) {
447 $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
449 $alertMsgOnChange = 'if(TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}';
452 $alertMsgOnChange = '';
454 $fakePA['fieldChangeFunc'] = $PA['fieldChangeFunc'];
455 if (strlen($alertMsgOnChange)) {
456 $fakePA['fieldChangeFunc']['alert'] = $alertMsgOnChange;
458 $fakePA['onFocus'] = $PA['onFocus'];
459 $fakePA['label'] = $PA['label'];
460 $fakePA['itemFormElName'] = $PA['itemFormElName'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']';
461 $fakePA['itemFormElName_file'] = $PA['itemFormElName_file'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']';
462 $fakePA['itemFormElID'] = $fakePA['itemFormElName'];
463 if (isset($editData[$key][$vDEFkey])) {
464 $fakePA['itemFormElValue'] = $editData[$key][$vDEFkey];
466 $fakePA['itemFormElValue'] = $fakePA['fieldConf']['config']['default'];
468 $theFormEl = $this->formEngine
->getSingleField_SW($table, $field, $row, $fakePA);
469 $theTitle = htmlspecialchars($fakePA['fieldConf']['label']);
470 if (!in_array('DEF', $rotateLang)) {
471 $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">'
472 . $this->formEngine
->getLanguageIcon($table, $row, 0)
473 . $this->formEngine
->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field)
478 if (!$PA['_noEditDEF']) {
479 $prLang = $this->formEngine
->getAdditionalPreviewLanguages();
480 foreach ($prLang as $prL) {
481 $defInfo .= '<div class="typo3-TCEforms-originalLanguageValue">'
482 . $this->formEngine
->getLanguageIcon($table, $row, ('v' . $prL['ISOcode']))
483 . $this->formEngine
->previewFieldValue($editData[$key][('v' . $prL['ISOcode'])], $fakePA['fieldConf'], $field)
488 if ($vDEFkey != 'vDEF') {
489 $languageIcon = $this->formEngine
->getLanguageIcon($table, $row, $vDEFkey);
492 // possible linebreaks in the label through xml: \n => <br/>, usage of nl2br()
493 // not possible, so it's done through str_replace
494 $processedTitle = str_replace('\\n', '<br />', $theTitle);
495 $tRows[] = '<div class="t3-form-field-container t3-form-field-container-flex">'
496 . '<div class="t3-form-field-label t3-form-field-label-flex">' . $languageIcon
497 . BackendUtility
::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '</div>
498 <div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo
499 . $this->formEngine
->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
504 $output .= implode('', $tRows);