34 $table = $result[
'tableName'];
36 foreach ($result[
'processedTca'][
'columns'] as $fieldName => $fieldConfig) {
37 if (empty($fieldConfig[
'config'][
'type']) || $fieldConfig[
'config'][
'type'] !==
'select') {
46 $fieldConfig[
'config'][
'items'] = $this->
sanitizeItemArray($fieldConfig[
'config'][
'items'] ?? [], $table, $fieldName);
49 if ($fieldConfig[
'config'][
'maxitems'] === 0) {
50 $fieldConfig[
'config'][
'maxitems'] = 99999;
53 $fieldConfig[
'config'][
'items'] = $this->
addItemsFromSpecial($result, $fieldName, $fieldConfig[
'config'][
'items']);
54 $fieldConfig[
'config'][
'items'] = $this->
addItemsFromFolder($result, $fieldName, $fieldConfig[
'config'][
'items']);
59 if (!empty($fieldConfig[
'config'][
'itemsProcFunc'])) {
62 unset($fieldConfig[
'config'][
'itemsProcFunc']);
69 $removedItems = $fieldConfig[
'config'][
'items'];
79 $removedItems = array_diff_key($removedItems, $fieldConfig[
'config'][
'items']);
83 if (!empty($fieldConfig[
'config'][
'MM']) && $result[
'command'] !==
'new') {
86 $currentDatabaseValuesArray = [];
89 $result[
'databaseRow'][$fieldName] = $currentDatabaseValuesArray;
92 $itemArrayValues = array_column($fieldConfig[
'config'][
'items'], 1);
93 $itemArray = array_fill_keys(
95 $fieldConfig[
'config'][
'items']
104 $currentDatabaseValuesArray,
110 if (!($table ===
'sys_file_metadata' && $fieldName ===
'file')) {
111 $fieldConfig[
'config'][
'items'] = $this->
translateLabels($result, $fieldConfig[
'config'][
'items'], $table, $fieldName);
115 $fieldConfig[
'config'][
'items'] = array_values($fieldConfig[
'config'][
'items']);
117 $result[
'processedTca'][
'columns'][$fieldName] = $fieldConfig;
138 if (empty($fieldConf[
'config'][
'items'])
139 || $fieldConf[
'config'][
'renderType'] !==
'selectSingle'
140 || ($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'disableNoMatchingValueElement'] ??
false)
141 || ($fieldConf[
'config'][
'disableNoMatchingValueElement'] ??
false)
143 return $fieldConf[
'config'][
'items'];
147 $noMatchingLabel = isset($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'noMatchingValue_label'])
148 ? $languageService->sL(trim($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'noMatchingValue_label']))
149 :
'[ ' . $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue') .
' ]';
151 $unmatchedValues = array_diff(
152 array_values($databaseValues),
153 array_column($fieldConf[
'config'][
'items'], 1),
154 array_column($removedItems, 1)
157 foreach ($unmatchedValues as $unmatchedValue) {
159 @sprintf($noMatchingLabel, $unmatchedValue),
162 array_unshift($fieldConf[
'config'][
'items'], $invalidItem);
165 return $fieldConf[
'config'][
'items'];
176 return $fieldConfig[
'config'][
'renderType'] !==
'selectTree';