TYPO3 CMS  TYPO3_7-6
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  // Flex ds was normalized in flex provider to always have a sheet.
44  // Determine this single sheet name, most often it ends up with sDEF, except if only one sheet was defined
45  $flexFormSheetNames = array_keys($flexFormDataStructureArray['sheets']);
46  $sheetName = array_pop($flexFormSheetNames);
47  $flexFormRowDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?: [];
48 
49  // That was taken from GeneralUtility::resolveSheetDefInDS - no idea if it is important
50  unset($flexFormDataStructureArray['meta']);
51 
52  if (!is_array($flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'])) {
53  $resultArray['html'] = 'Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';
54  return $resultArray;
55  }
56 
57  // Assemble key for loading the correct CSH file
58  // @todo: what is that good for? That is for the title of single elements ... see FlexFormElementContainer!
59  $dsPointerFields = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['ds_pointerField'], true);
60  $parameterArray['_cshKey'] = $table . '.' . $fieldName;
61  foreach ($dsPointerFields as $key) {
62  if (is_string($row[$key]) && $row[$key] !== '') {
63  $parameterArray['_cshKey'] .= '.' . $row[$key];
64  } elseif (is_array($row[$key]) && isset($row[$key][0]) && is_string($row[$key][0]) && $row[$key][0] !== '') {
65  $parameterArray['_cshKey'] .= '.' . $row[$key][0];
66  }
67  }
68 
69  $options = $this->data;
70  $options['flexFormDataStructureArray'] = $flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'];
71  $options['flexFormRowData'] = $flexFormRowDataSubPart;
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']