‪TYPO3CMS  10.4
FlexFormNoTabsContainer.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
28 {
34  protected ‪$defaultFieldInformation = [
35  'tcaDescription' => [
36  'renderType' => 'tcaDescription',
37  ],
38  ];
39 
45  public function ‪render()
46  {
47  $table = $this->data['tableName'];
48  $row = $this->data['databaseRow'];
49  $fieldName = $this->data['fieldName']; // field name of the flex form field in DB
50  $parameterArray = $this->data['parameterArray'];
51  $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
52  $flexFormRowData = $this->data['flexFormRowData'];
53  $resultArray = $this->‪initializeResultArray();
54 
55  // Determine this single sheet name, most often it ends up with sDEF, except if only one sheet was defined
56  $flexFormSheetNames = array_keys($flexFormDataStructureArray['sheets']);
57  $sheetName = array_pop($flexFormSheetNames);
58  $flexFormRowDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?: [];
59 
60  unset($flexFormDataStructureArray['meta']);
61 
62  if (!is_array($flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'])) {
63  $resultArray['html'] = 'Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';
64  return $resultArray;
65  }
66 
67  // Assemble key for loading the correct CSH file
68  // @todo: what is that good for? That is for the title of single elements ... see FlexFormElementContainer!
69  $dsPointerFields = ‪GeneralUtility::trimExplode(',', ‪$GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['ds_pointerField'], true);
70  $parameterArray['_cshKey'] = $table . '.' . $fieldName;
71  foreach ($dsPointerFields as $key) {
72  if (is_string($row[$key]) && $row[$key] !== '') {
73  $parameterArray['_cshKey'] .= '.' . $row[$key];
74  } elseif (is_array($row[$key]) && isset($row[$key][0]) && is_string($row[$key][0]) && $row[$key][0] !== '') {
75  $parameterArray['_cshKey'] .= '.' . $row[$key][0];
76  }
77  }
78 
79  $options = ‪$this->data;
80  $options['flexFormDataStructureArray'] = $flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'];
81  $options['flexFormRowData'] = $flexFormRowDataSubPart;
82  $options['flexFormSheetName'] = $sheetName;
83  $options['flexFormFormPrefix'] = '[data][' . $sheetName . '][lDEF]';
84  $options['parameterArray'] = $parameterArray;
85 
86  $resultArray = $this->‪initializeResultArray();
87 
88  $fieldInformationResult = $this->‪renderFieldInformation();
89  $resultArray['html'] = '<div>' . $fieldInformationResult['html'] . '</div>';
90  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
91 
92  $options['renderType'] = 'flexFormElementContainer';
93  $childResult = $this->nodeFactory->create($options)->render();
94  return $this->‪mergeChildReturnIntoExistingResult($resultArray, $childResult, true);
95  }
96 }
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer
Definition: FlexFormNoTabsContainer.php:28
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\render
‪array render()
Definition: FlexFormNoTabsContainer.php:44
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:116
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:90
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:16
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:42
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:28
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractContainer.php:34
‪TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode
‪static string[] trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:1059
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: FlexFormNoTabsContainer.php:33
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46