2 namespace TYPO3\CMS\Backend\Form\FormDataProvider;
37 $table = $result[
'tableName'];
39 foreach ($result[
'processedTca'][
'columns'] as $fieldName => $fieldConfig) {
40 if (empty($fieldConfig[
'config'][
'type']) || $fieldConfig[
'config'][
'type'] !==
'select') {
49 $fieldConfig[
'config'][
'items'] = $this->
sanitizeItemArray($fieldConfig[
'config'][
'items'], $table, $fieldName);
50 $fieldConfig[
'config'][
'maxitems'] = $this->
sanitizeMaxItems($fieldConfig[
'config'][
'maxitems']);
52 $fieldConfig[
'config'][
'items'] = $this->
addItemsFromSpecial($result, $fieldName, $fieldConfig[
'config'][
'items']);
53 $fieldConfig[
'config'][
'items'] = $this->
addItemsFromFolder($result, $fieldName, $fieldConfig[
'config'][
'items']);
54 $staticItems = $fieldConfig[
'config'][
'items'];
56 $fieldConfig[
'config'][
'items'] = $this->addItemsFromForeignTable($result, $fieldName, $fieldConfig[
'config'][
'items']);
57 $dynamicItems = array_diff_key($fieldConfig[
'config'][
'items'], $staticItems);
60 $fieldConfig[
'config'][
'items'] = $this->
addItemsFromPageTsConfig($result, $fieldName, $fieldConfig[
'config'][
'items']);
68 if (!empty($fieldConfig[
'config'][
'itemsProcFunc'])) {
69 $fieldConfig[
'config'][
'items'] = $this->resolveItemProcessorFunction($result, $fieldName, $fieldConfig[
'config'][
'items']);
71 unset($fieldConfig[
'config'][
'itemsProcFunc']);
75 $fieldConfig[
'config'][
'items'] = $this->
translateLabels($result, $fieldConfig[
'config'][
'items'], $table, $fieldName);
77 $staticValues = $this->
getStaticValues($fieldConfig[
'config'][
'items'], $dynamicItems);
79 $result[
'databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $staticValues);
82 $fieldConfig[
'config'][
'items'] = array_values($fieldConfig[
'config'][
'items']);
84 $fieldConfig[
'config'][
'treeData'] = $this->renderTree($result, $fieldConfig, $fieldName, $staticItems);
86 $result[
'processedTca'][
'columns'][$fieldName] = $fieldConfig;
101 protected function renderTree(array $result, array $fieldConfig, $fieldName, array $staticItems)
104 foreach ($fieldConfig[
'config'][
'items'] as $item) {
105 if ((
int)$item[1] > 0) {
106 $allowedUids[] = $item[1];
110 $treeDataProvider = TreeDataProviderFactory::getDataProvider(
111 $fieldConfig[
'config'],
112 $result[
'tableName'],
114 $result[
'databaseRow']
116 $treeDataProvider->setSelectedList(is_array($result[
'databaseRow'][$fieldName]) ? implode(
',', $result[
'databaseRow'][$fieldName]) : $result[
'databaseRow'][$fieldName]);
117 $treeDataProvider->setItemWhiteList($allowedUids);
118 $treeDataProvider->initializeTreeData();
125 $tree->setDataProvider($treeDataProvider);
126 $tree->setNodeRenderer($treeRenderer);
129 $treeItems[] = $tree->render();
132 'items' => $treeItems,
133 'selectedNodes' => $this->
prepareSelectedNodes($fieldConfig[
'config'][
'items'], $result[
'databaseRow'][$fieldName])
148 $additionalItems = [];
150 foreach ($itemArray as $item) {
151 if ($item[1] ===
'--div--') {
155 $additionalItems[] = [
158 'selectable' =>
true,
160 'checked' => in_array($item[1], $selectedNodes),
165 return $additionalItems;
179 if (!empty($databaseValues)) {
180 foreach ($databaseValues as $selectedNode) {
181 foreach ($itemArray as $possibleSelectBoxItem) {
182 if ((
string)$possibleSelectBoxItem[1] === (
string)$selectedNode) {
183 $selectedNodes[] = $selectedNode .
'|' . rawurlencode($possibleSelectBoxItem[0]);
189 return $selectedNodes;
200 return $fieldConfig[
'config'][
'renderType'] ===
'selectTree';