‪TYPO3CMS  ‪main
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 
26 {
32  protected ‪$defaultFieldInformation = [
33  'tcaDescription' => [
34  'renderType' => 'tcaDescription',
35  ],
36  ];
37 
43  public function ‪render(): array
44  {
45  $parameterArray = $this->data['parameterArray'];
46  $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
47  $flexFormRowData = $this->data['flexFormRowData'];
48  $resultArray = $this->‪initializeResultArray();
49 
50  // Determine this single sheet name, most often it ends up with sDEF, except if only one sheet was defined
51  $flexFormSheetNames = array_keys($flexFormDataStructureArray['sheets']);
52  $sheetName = array_pop($flexFormSheetNames);
53  $flexFormRowDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?? [];
54 
55  unset($flexFormDataStructureArray['meta']);
56 
57  if (!is_array($flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'])) {
58  $resultArray['html'] = 'Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';
59  return $resultArray;
60  }
61 
62  $options = ‪$this->data;
63  $options['flexFormDataStructureArray'] = $flexFormDataStructureArray['sheets'][$sheetName]['ROOT']['el'];
64  $options['flexFormRowData'] = $flexFormRowDataSubPart;
65  $options['flexFormSheetName'] = $sheetName;
66  $options['flexFormFormPrefix'] = '[data][' . $sheetName . '][lDEF]';
67  $options['parameterArray'] = $parameterArray;
68 
69  $resultArray = $this->‪initializeResultArray();
70 
71  $fieldInformationResult = $this->‪renderFieldInformation();
72  $resultArray['html'] = '<div>' . $fieldInformationResult['html'] . '</div>';
73  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
74 
75  $options['renderType'] = 'flexFormElementContainer';
76  $childResult = $this->nodeFactory->create($options)->render();
77  return $this->‪mergeChildReturnIntoExistingResult($resultArray, $childResult, true);
78  }
79 }
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer
Definition: FlexFormNoTabsContainer.php:26
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\render
‪array render()
Definition: FlexFormNoTabsContainer.php:42
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:104
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:16
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:35
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:29
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractContainer.php:52
‪TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: FlexFormNoTabsContainer.php:31
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪initializeResultArray()
Definition: AbstractNode.php:77