‪TYPO3CMS  9.5
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  protected ‪$defaultFieldInformation = [
34  'tcaDescription' => [
35  'renderType' => 'tcaDescription',
36  ],
37  ];
38 
44  public function ‪render()
45  {
46  $table = $this->data['tableName'];
47  $row = $this->data['databaseRow'];
48  $fieldName = $this->data['fieldName']; // field name of the flex form field in DB
49  $parameterArray = $this->data['parameterArray'];
50  $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
51  $flexFormRowData = $this->data['flexFormRowData'];
52  $resultArray = $this->‪initializeResultArray();
53 
54  // Determine this single sheet name, most often it ends up with sDEF, except if only one sheet was defined
55  $flexFormSheetNames = array_keys($flexFormDataStructureArray['sheets']);
56  $sheetName = array_pop($flexFormSheetNames);
57  $flexFormRowDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?: [];
58 
59  unset($flexFormDataStructureArray['meta']);
60 
61  if (!is_array($flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'])) {
62  $resultArray['html'] = 'Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';
63  return $resultArray;
64  }
65 
66  // Assemble key for loading the correct CSH file
67  // @todo: what is that good for? That is for the title of single elements ... see FlexFormElementContainer!
68  $dsPointerFields = GeneralUtility::trimExplode(',', ‪$GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['ds_pointerField'], true);
69  $parameterArray['_cshKey'] = $table . '.' . $fieldName;
70  foreach ($dsPointerFields as $key) {
71  if (is_string($row[$key]) && $row[$key] !== '') {
72  $parameterArray['_cshKey'] .= '.' . $row[$key];
73  } elseif (is_array($row[$key]) && isset($row[$key][0]) && is_string($row[$key][0]) && $row[$key][0] !== '') {
74  $parameterArray['_cshKey'] .= '.' . $row[$key][0];
75  }
76  }
77 
78  $options = ‪$this->data;
79  $options['flexFormDataStructureArray'] = $flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'];
80  $options['flexFormRowData'] = $flexFormRowDataSubPart;
81  $options['flexFormSheetName'] = $sheetName;
82  $options['flexFormFormPrefix'] = '[data][' . $sheetName . '][lDEF]';
83  $options['parameterArray'] = $parameterArray;
84 
85  $resultArray = $this->‪initializeResultArray();
86 
87  $fieldInformationResult = $this->‪renderFieldInformation();
88  $resultArray['html'] = '<div>' . $fieldInformationResult['html'] . '</div>';
89  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
90 
91  $options['renderType'] = 'flexFormElementContainer';
92  $childResult = $this->nodeFactory->create($options)->render();
93  return $this->‪mergeChildReturnIntoExistingResult($resultArray, $childResult, true);
94  }
95 }
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer
Definition: FlexFormNoTabsContainer.php:27
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\render
‪array render()
Definition: FlexFormNoTabsContainer.php:43
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:115
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:88
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:2
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:40
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:27
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractContainer.php:33
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: FlexFormNoTabsContainer.php:32
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45