[ 'renderType' => 'localizationStateSelector', ], 'otherLanguageContent' => [ 'renderType' => 'otherLanguageContent', 'after' => [ 'localizationStateSelector', ], ], 'defaultLanguageDifferences' => [ 'renderType' => 'defaultLanguageDifferences', 'after' => [ 'otherLanguageContent', ], ], ]; public function __construct( private readonly IconFactory $iconFactory, private readonly HashService $hashService, ) {} /** * This will render a single-line input form field, possibly with various control/validation features * * @return array As defined in initializeResultArray() of AbstractNode */ public function render(): array { $table = $this->data['tableName']; $row = $this->data['databaseRow']; $parameterArray = $this->data['parameterArray']; $resultArray = $this->initializeResultArray(); $languageId = 0; if ($this->data['tcaSchemata']->has($table) && $this->data['tcaSchemata']->get($table)->hasCapability(TcaSchemaCapability::Language)) { $languageField = $this->data['tcaSchemata']->get($table)->getCapability(TcaSchemaCapability::Language)->getLanguageField()->getName(); $languageId = (int)((is_array($row[$languageField] ?? null) ? ($row[$languageField][0] ?? 0) : $row[$languageField]) ?? 0); } $itemValue = $parameterArray['itemFormElValue']; $config = $parameterArray['fieldConf']['config']; $evalList = GeneralUtility::trimExplode(',', $config['eval'] ?? '', true); $size = MathUtility::forceIntegerInRange($config['size'] ?? $this->defaultInputWidth, $this->minimumInputWidth, $this->maxInputWidth); $width = $this->formMaxWidth($size); $baseUrl = $this->data['customData'][$this->data['fieldName']]['slugPrefix'] ?? ''; $fieldId = StringUtility::getUniqueId('formengine-input-'); $renderedLabel = $this->renderLabel($fieldId); // Convert UTF-8 characters back (that is important, see Slug class when sanitizing) $itemValue = rawurldecode($itemValue); $fieldInformationResult = $this->renderFieldInformation(); $fieldInformationHtml = $fieldInformationResult['html']; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false); // readOnly is not supported as columns config but might be set by SingleFieldContainer in case // "l10n_display" is set to "defaultAsReadonly". To prevent misbehaviour for fields, which falsely // set this, we also check for "defaultAsReadonly" being set and whether the record is an overlay. if (($config['readOnly'] ?? false) && ($this->data['processedTca']['ctrl']['transOrigPointerField'] ?? false) && ($row[$this->data['processedTca']['ctrl']['transOrigPointerField']][0] ?? $row[$this->data['processedTca']['ctrl']['transOrigPointerField']] ?? false) && GeneralUtility::inList($parameterArray['fieldConf']['l10n_display'] ?? '', 'defaultAsReadonly') ) { $disabledFieldAttributes = [ 'class' => 'form-control', 'data-formengine-input-name' => $parameterArray['itemFormElName'], 'type' => 'text', 'value' => $itemValue, 'title' => $itemValue, 'id' => $fieldId, ]; $html = []; $html[] = $renderedLabel; $html[] = '