[ 'renderType' => 'localizationStateSelector', ], ]; /** * Default number of tree nodes to show (determines tree height) * when no ['config']['size'] is set * * @var int */ protected $itemsToShow = 15; /** * Number of items to show at last * e.g. when you have only 2 items in a tree * * @var int */ protected $minItemsToShow = 5; /** * Pixel height of a single tree node * * @var int */ protected $itemHeight = 20; /** * Render tree widget * * @return array As defined in initializeResultArray() of AbstractNode * @see AbstractNode::initializeResultArray() */ public function render(): array { $resultArray = $this->initializeResultArray(); $parameterArray = $this->data['parameterArray']; $formElementId = md5($parameterArray['itemFormElName']); // Field configuration from TCA: $config = $parameterArray['fieldConf']['config']; $readOnly = !empty($config['readOnly']); $exclusiveKeys = !empty($config['exclusiveKeys']) ? $config['exclusiveKeys'] : ''; $exclusiveKeys = $exclusiveKeys . ','; $appearance = !empty($config['treeConfig']['appearance']) ? $config['treeConfig']['appearance'] : []; $expanded = !empty($appearance['expandAll']); $showHeader = !empty($appearance['showHeader']); if (isset($config['size']) && (int)$config['size'] > 0) { $height = max($this->minItemsToShow, (int)$config['size']); } else { $height = $this->itemsToShow; } $heightInPx = $height * $this->itemHeight; $treeWrapperId = 'tree_' . $formElementId; $fieldId = 'tree_record_' . $formElementId; $fieldName = $this->data['fieldName']; $dataStructureIdentifier = ''; $flexFormSheetName = ''; $flexFormFieldName = ''; $flexFormContainerName = ''; $flexFormContainerIdentifier = ''; $flexFormContainerFieldName = ''; $flexFormSectionContainerIsNew = false; if ($this->data['processedTca']['columns'][$fieldName]['config']['type'] === 'flex') { $dataStructureIdentifier = $this->data['processedTca']['columns'][$fieldName]['config']['dataStructureIdentifier']; if (isset($this->data['flexFormSheetName'])) { $flexFormSheetName = $this->data['flexFormSheetName']; } if (isset($this->data['flexFormFieldName'])) { $flexFormFieldName = $this->data['flexFormFieldName']; } if (isset($this->data['flexFormContainerName'])) { $flexFormContainerName = $this->data['flexFormContainerName']; } if (isset($this->data['flexFormContainerFieldName'])) { $flexFormContainerFieldName = $this->data['flexFormContainerFieldName']; } if (isset($this->data['flexFormContainerIdentifier'])) { $flexFormContainerIdentifier = $this->data['flexFormContainerIdentifier']; } // Add a flag this is a tree in a new flex section container element. This is needed to initialize // the databaseRow with this container again so the tree data provider is able to calculate tree items. if (!empty($this->data['flexSectionContainerPreparation'])) { $flexFormSectionContainerIsNew = true; } } $fieldInformationResult = $this->renderFieldInformation(); $fieldInformationHtml = $fieldInformationResult['html']; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false); $fieldWizardResult = $this->renderFieldWizard(); $fieldWizardHtml = $fieldWizardResult['html']; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false); $html = []; $html[] = '