‪TYPO3CMS  ‪main
FlexFormTabsContainer.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 
20 
28 {
34  protected ‪$defaultFieldInformation = [
35  'tcaDescription' => [
36  'renderType' => 'tcaDescription',
37  ],
38  ];
39 
45  public function ‪render(): array
46  {
47  $languageService = $this->‪getLanguageService();
48 
49  $parameterArray = $this->data['parameterArray'];
50  $flexFormDataStructureArray = $this->data['flexFormDataStructureArray'];
51  $flexFormRowData = $this->data['flexFormRowData'];
52 
53  $resultArray = $this->‪initializeResultArray();
54  $resultArray['javaScriptModules'][] = ‪JavaScriptModuleInstruction::create('@typo3/backend/tabs.js');
55 
56  $domIdPrefix = 'DTM-' . md5($this->data['parameterArray']['itemFormElName']);
57  $tabCounter = 0;
58  $tabElements = [];
59  foreach ($flexFormDataStructureArray['sheets'] as $sheetName => $sheetDataStructure) {
60  $flexFormRowSheetDataSubPart = $flexFormRowData['data'][$sheetName]['lDEF'] ?? [];
61 
62  if (!is_array($sheetDataStructure['ROOT']['el'])) {
63  $resultArray['html'] .= LF . 'No Data Structure ERROR: No [\'ROOT\'][\'el\'] found for sheet "' . $sheetName . '".';
64  continue;
65  }
66 
67  $tabCounter++;
68 
69  $options = ‪$this->data;
70  $options['flexFormDataStructureArray'] = $sheetDataStructure['ROOT']['el'];
71  $options['flexFormRowData'] = $flexFormRowSheetDataSubPart;
72  $options['flexFormSheetName'] = $sheetName;
73  $options['flexFormFormPrefix'] = '[data][' . $sheetName . '][lDEF]';
74  $options['parameterArray'] = $parameterArray;
75  // Merge elements of this tab into a single list again and hand over to
76  // palette and single field container to render this group
77  $options['tabAndInlineStack'][] = [
78  'tab',
79  $domIdPrefix . '-' . $tabCounter,
80  ];
81  $options['renderType'] = 'flexFormElementContainer';
82  $childReturn = $this->nodeFactory->create($options)->render();
83 
84  if ($childReturn['html'] !== '') {
85  $tabElements[] = [
86  'label' => !empty(trim($sheetDataStructure['ROOT']['sheetTitle'] ?? '')) ? $languageService->sL(trim($sheetDataStructure['ROOT']['sheetTitle'])) : $sheetName,
87  'content' => $childReturn['html'],
88  'description' => trim($sheetDataStructure['ROOT']['sheetDescription'] ?? '') ? $languageService->sL(trim($sheetDataStructure['ROOT']['sheetDescription'])) : '',
89  'linkTitle' => trim($sheetDataStructure['ROOT']['sheetShortDescr'] ?? '') ? $languageService->sL(trim($sheetDataStructure['ROOT']['sheetShortDescr'])) : '',
90  ];
91  }
92  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $childReturn, false);
93  }
94 
95  $fieldInformationResult = $this->‪renderFieldInformation();
96  $resultArray['html'] = '<div>' . $fieldInformationResult['html'] . '</div>';
97  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
98 
99  $resultArray['html'] .= $this->‪renderTabMenu($tabElements, $domIdPrefix);
100  return $resultArray;
101  }
102 
103  protected function ‪getLanguageService(): ‪LanguageService
104  {
105  return ‪$GLOBALS['LANG'];
106  }
107 }
‪TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: FlexFormTabsContainer.php:33
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:104
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction\create
‪static create(string $name, string $exportName=null)
Definition: JavaScriptModuleInstruction.php:47
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:16
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction
Definition: JavaScriptModuleInstruction.php:23
‪TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer\getLanguageService
‪getLanguageService()
Definition: FlexFormTabsContainer.php:102
‪TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer\render
‪array render()
Definition: FlexFormTabsContainer.php:44
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderTabMenu
‪renderTabMenu(array $menuItems, string $domId)
Definition: AbstractContainer.php:127
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:35
‪TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer
Definition: FlexFormTabsContainer.php:28
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:29
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractContainer.php:52
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪initializeResultArray()
Definition: AbstractNode.php:77