[ 'renderType' => 'selectIcons', 'disabled' => true, ], 'localizationStateSelector' => [ 'renderType' => 'localizationStateSelector', 'after' => [ 'selectIcons', ], ], 'otherLanguageContent' => [ 'renderType' => 'otherLanguageContent', 'after' => [ 'localizationStateSelector' ], ], 'defaultLanguageDifferences' => [ 'renderType' => 'defaultLanguageDifferences', 'after' => [ 'otherLanguageContent' ], ], ]; public function __construct( private readonly InlineStackProcessor $inlineStackProcessor, ) {} /** * Render single element * * @return array As defined in initializeResultArray() of AbstractNode */ public function render(): array { $resultArray = $this->initializeResultArray(); $table = $this->data['tableName']; $field = $this->data['fieldName']; $parameterArray = $this->data['parameterArray']; $config = $parameterArray['fieldConf']['config']; $selectItems = $parameterArray['fieldConf']['config']['items']; $classList = ['form-select', 'form-control-adapt']; // Check against inline uniqueness $uniqueIds = []; if (($this->data['isInlineChild'] ?? false) && ($this->data['inlineParentUid'] ?? false)) { // If config[foreign_unique] is set for the parent inline field, all // already used unique ids must be excluded from the select items. $inlineObjectName = $this->inlineStackProcessor->getDomObjectIdPrefixFromStructure($this->data['inlineStructure'], $this->data['inlineFirstPid']); if (($this->data['inlineParentConfig']['foreign_table'] ?? false) === $table && ($this->data['inlineParentConfig']['foreign_unique'] ?? false) === $field ) { $classList[] = 't3js-inline-unique'; $uniqueIds = $this->data['inlineData']['unique'][$inlineObjectName . '-' . $table]['used'] ?? []; } // hide uid of parent record for symmetric relations if (($this->data['inlineParentConfig']['foreign_table'] ?? false) === $table && ( ($this->data['inlineParentConfig']['foreign_field'] ?? false) === $field || ($this->data['inlineParentConfig']['symmetric_field'] ?? false) === $field ) ) { $uniqueIds[] = $this->data['inlineParentUid']; } $uniqueIds = array_map(intval(...), $uniqueIds); } // Initialization: $selectId = StringUtility::getUniqueId('tceforms-select-'); $selectedItem = null; $size = (int)($config['size'] ?? 0); // Style set on '; $html[] = $options; $html[] = ''; if ($hasIcons) { $html[] = ''; } $html[] = ''; if (!$disabled && !empty($fieldControlHtml)) { $html[] = '
'; $html[] = '
'; $html[] = $fieldControlHtml; $html[] = '
'; $html[] = '
'; } if (!$disabled && !empty($fieldWizardHtml)) { $html[] = '
'; $html[] = $fieldWizardHtml; $html[] = '
'; } $html[] = ''; $html[] = ''; $html[] = ''; $onFieldChangeItems = $this->getOnFieldChangeItems($parameterArray['fieldChangeFunc'] ?? []); $resultArray['javaScriptModules']['selectSingleElement'] = JavaScriptModuleInstruction::create( '@typo3/backend/form-engine/element/select-single-element.js' )->invoke('initializeOnReady', '#' . $selectId, ['onChange' => $onFieldChangeItems]); $resultArray['html'] = implode(LF, $html); return $resultArray; } }