37 'renderType' =>
'tcaDescription',
48 'renderType' =>
'selectIcons',
51 'localizationStateSelector' => [
52 'renderType' =>
'localizationStateSelector',
57 'otherLanguageContent' => [
58 'renderType' =>
'otherLanguageContent',
59 'after' => [
'localizationStateSelector' ],
61 'defaultLanguageDifferences' => [
62 'renderType' =>
'defaultLanguageDifferences',
63 'after' => [
'otherLanguageContent' ],
76 $table = $this->data[
'tableName'];
77 $field = $this->data[
'fieldName'];
78 $row = $this->data[
'databaseRow'];
79 $parameterArray = $this->data[
'parameterArray'];
80 $config = $parameterArray[
'fieldConf'][
'config'];
82 $selectItems = $parameterArray[
'fieldConf'][
'config'][
'items'];
86 $inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
87 $inlineStackProcessor->initializeByGivenStructure($this->data[
'inlineStructure']);
89 if ($this->data[
'isInlineChild'] && $this->data[
'inlineParentUid']) {
93 $inlineObjectName = $inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data[
'inlineFirstPid']);
94 $inlineFormName = $inlineStackProcessor->getCurrentStructureFormPrefix();
95 if ($this->data[
'inlineParentConfig'][
'foreign_table'] === $table
96 && $this->data[
'inlineParentConfig'][
'foreign_unique'] === $field
98 $uniqueIds = $this->data[
'inlineData'][
'unique'][$inlineObjectName .
'-' . $table][
'used'];
99 $parameterArray[
'fieldChangeFunc'][
'inlineUnique'] =
'inline.updateUnique(this,'
100 . GeneralUtility::quoteJSvalue($inlineObjectName .
'-' . $table) .
','
101 . GeneralUtility::quoteJSvalue($inlineFormName) .
','
102 . GeneralUtility::quoteJSvalue($row[
'uid']) .
');';
105 if ($this->data[
'inlineParentConfig'][
'foreign_table'] === $table
107 $this->data[
'inlineParentConfig'][
'foreign_field'] === $field
108 || $this->data[
'inlineParentConfig'][
'symmetric_field'] === $field
111 $uniqueIds[] = $this->data[
'inlineParentUid'];
118 $size = (int)$config[
'size'];
123 if (!empty($config[
'readOnly'])) {
128 $selectItemCounter = 0;
129 $selectItemGroupCount = 0;
130 $selectItemGroups = [];
135 if (!empty($parameterArray[
'itemFormElValue'])) {
136 if (is_array($parameterArray[
'itemFormElValue'])) {
137 $selectedValue = (string)$parameterArray[
'itemFormElValue'][0];
139 $selectedValue = (string)$parameterArray[
'itemFormElValue'];
143 foreach ($selectItems as $item) {
144 if ($item[1] ===
'--div--') {
146 if ($selectItemCounter !== 0) {
147 $selectItemGroupCount++;
149 $selectItemGroups[$selectItemGroupCount][
'header'] = [
155 $selected = $selectedValue === (string)$item[1];
158 $selectedIcon = $icon;
161 $selectItemGroups[$selectItemGroupCount][
'items'][] = [
165 'selected' => $selected,
167 $selectItemCounter++;
173 if (!$selectedIcon && $selectItemGroups[0][
'items'][0][
'icon']) {
174 $selectedIcon = $selectItemGroups[0][
'items'][0][
'icon'];
178 foreach ($selectItemGroups as $selectItemGroup) {
180 if (empty($selectItemGroup[
'items'])) {
184 $optionGroup = is_array($selectItemGroup[
'header']);
185 $options .= ($optionGroup ?
'<optgroup label="' . htmlspecialchars($selectItemGroup[
'header'][
'title'], ENT_COMPAT,
'UTF-8',
false) .
'">' :
'');
187 if (is_array($selectItemGroup[
'items'])) {
188 foreach ($selectItemGroup[
'items'] as $item) {
189 $options .=
'<option value="' . htmlspecialchars($item[
'value']) .
'" data-icon="' .
190 htmlspecialchars($item[
'icon']) .
'"'
191 . ($item[
'selected'] ?
' selected="selected"' :
'') .
'>' . htmlspecialchars($item[
'title'], ENT_COMPAT,
'UTF-8',
false) .
'</option>';
193 $hasIcons = !empty($item[
'icon']);
196 $options .= ($optionGroup ?
'</optgroup>' :
'');
199 $selectAttributes = [
201 'name' => $parameterArray[
'itemFormElName'],
203 'class' =>
'form-control form-control-adapt',
206 $selectAttributes[
'size'] = $size;
209 $selectAttributes[
'disabled'] =
'disabled';
213 $fieldInformationHtml = $fieldInformationResult[
'html'];
217 $fieldWizardHtml = $fieldWizardResult[
'html'];
221 $html[] =
'<div class="formengine-field-item t3js-formengine-field-item">';
222 $html[] = $fieldInformationHtml;
223 $html[] =
'<div class="form-control-wrap">';
224 $html[] =
'<div class="form-wizards-wrap">';
225 $html[] =
'<div class="form-wizards-element">';
227 $html[] =
'<div class="input-group">';
228 $html[] =
'<span class="input-group-addon input-group-icon">';
229 $html[] = $selectedIcon;
232 $html[] =
'<select ' . GeneralUtility::implodeAttributes($selectAttributes,
true) .
'>';
234 $html[] =
'</select>';
239 if (!$disabled && !empty($fieldWizardHtml)) {
240 $html[] =
'<div class="form-wizards-items-bottom">';
241 $html[] = $fieldWizardHtml;
248 $resultArray[
'requireJsModules'][] = [
'TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement' => implode(LF, [
249 'function(SelectSingleElement) {',
250 'require([\'jquery\'], function($) {',
252 'SelectSingleElement.initialize(',
253 GeneralUtility::quoteJSvalue(
'#' . $selectId) .
',',
255 'onChange: function() {',
256 implode(
'', $parameterArray[
'fieldChangeFunc']),
265 $resultArray[
'html'] = implode(LF, $html);