TYPO3 CMS  TYPO3_8-7
FlexFormNoTabsContainer.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
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.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
27 {
33  public function render()
34  {
35  $table = $this->data['tableName'];
36  $row = $this->data['databaseRow'];
37  $fieldName = $this->data['fieldName']; // field name of the flex form field in DB
38  $parameterArray = $this->data['parameterArray'];
39  $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
40  $flexFormRowData = $this->data['flexFormRowData'];
41  $resultArray = $this->initializeResultArray();
42 
43  // Determine this single sheet name, most often it ends up with sDEF, except if only one sheet was defined
44  $flexFormSheetNames = array_keys($flexFormDataStructureArray['sheets']);
45  $sheetName = array_pop($flexFormSheetNames);
46  $flexFormRowDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?: [];
47 
48  // That was taken from GeneralUtility::resolveSheetDefInDS - no idea if it is important
49  unset($flexFormDataStructureArray['meta']);
50 
51  if (!is_array($flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'])) {
52  $resultArray['html'] = 'Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';
53  return $resultArray;
54  }
55 
56  // Assemble key for loading the correct CSH file
57  // @todo: what is that good for? That is for the title of single elements ... see FlexFormElementContainer!
58  $dsPointerFields = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['ds_pointerField'], true);
59  $parameterArray['_cshKey'] = $table . '.' . $fieldName;
60  foreach ($dsPointerFields as $key) {
61  if (is_string($row[$key]) && $row[$key] !== '') {
62  $parameterArray['_cshKey'] .= '.' . $row[$key];
63  } elseif (is_array($row[$key]) && isset($row[$key][0]) && is_string($row[$key][0]) && $row[$key][0] !== '') {
64  $parameterArray['_cshKey'] .= '.' . $row[$key][0];
65  }
66  }
67 
68  $options = $this->data;
69  $options['flexFormDataStructureArray'] = $flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'];
70  $options['flexFormRowData'] = $flexFormRowDataSubPart;
71  $options['flexFormSheetName'] = $sheetName;
72  $options['flexFormFormPrefix'] = '[data][' . $sheetName . '][lDEF]';
73  $options['parameterArray'] = $parameterArray;
74 
75  $options['renderType'] = 'flexFormElementContainer';
76  return $this->nodeFactory->create($options)->render();
77  }
78 }
static trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']