[ 'renderType' => 'tcaDescription', ], ]; /** * Default field wizards enabled for this element. * * @var array */ protected $defaultFieldWizard = [ 'selectIcons' => [ 'renderType' => 'selectIcons', 'disabled' => true, ], 'localizationStateSelector' => [ 'renderType' => 'localizationStateSelector', 'after' => [ 'selectIcons', ], ], 'otherLanguageContent' => [ 'renderType' => 'otherLanguageContent', 'after' => [ 'localizationStateSelector' ], ], 'defaultLanguageDifferences' => [ 'renderType' => 'defaultLanguageDifferences', 'after' => [ 'otherLanguageContent' ], ], ]; /** * Render single element * * @return array As defined in initializeResultArray() of AbstractNode */ public function render() { $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 /** @var InlineStackProcessor $inlineStackProcessor */ $inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class); $inlineStackProcessor->initializeByGivenStructure($this->data['inlineStructure']); $uniqueIds = null; if ($this->data['isInlineChild'] && $this->data['inlineParentUid']) { // @todo: At least parts of this if is dead and/or broken: $uniqueIds is filled but never used. // See InlineControlContainer where 'inlineData' 'unique' 'used' is set. What exactly is // this if supposed to do and when should it kick in and what for? $inlineObjectName = $inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']); if ($this->data['inlineParentConfig']['foreign_table'] === $table && $this->data['inlineParentConfig']['foreign_unique'] === $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'] === $table && ( $this->data['inlineParentConfig']['foreign_field'] === $field || $this->data['inlineParentConfig']['symmetric_field'] === $field ) ) { $uniqueIds[] = $this->data['inlineParentUid']; } } // Initialization: $selectId = StringUtility::getUniqueId('tceforms-select-'); $selectedIcon = ''; $size = (int)$config['size']; // 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[] = ''; $resultArray['requireJsModules'][] = ['TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement' => implode(LF, [ 'function(SelectSingleElement) {', 'require([\'TYPO3/CMS/Core/DocumentService\'], function(DocumentService) {', 'DocumentService.ready().then(function() {', 'SelectSingleElement.initialize(', GeneralUtility::quoteJSvalue('#' . $selectId) . ',', '{', 'onChange: function() {', implode('', $parameterArray['fieldChangeFunc']), '}', '}', ');', '});', '});', '}', ])]; $resultArray['html'] = implode(LF, $html); return $resultArray; } }