46 foreach ($result[
'processedTca'][
'columns'] as $fieldName => $fieldConfig) {
47 if (empty($fieldConfig[
'config'][
'type']) || $fieldConfig[
'config'][
'type'] !==
'flex') {
72 if (!isset($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'dataStructureIdentifier'])) {
73 $flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
75 $dataStructureArray = [
'sheets' => [
'sDEF' => []]];
78 $dataStructureIdentifier = $flexFormTools->getDataStructureIdentifier(
79 $result[
'processedTca'][
'columns'][$fieldName],
82 $result[
'databaseRow']
84 $dataStructureArray = $flexFormTools->parseDataStructureByIdentifier($dataStructureIdentifier);
92 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'dataStructureIdentifier'] = $dataStructureIdentifier;
96 $dataStructureArray = $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'];
98 if (!isset($dataStructureArray[
'meta']) || !is_array($dataStructureArray[
'meta'])) {
99 $dataStructureArray[
'meta'] = [];
104 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'] = $dataStructureArray;
117 if (!array_key_exists($fieldName, $result[
'databaseRow'])) {
118 $result[
'databaseRow'][$fieldName] =
'';
121 if (isset($result[
'databaseRow'][$fieldName])) {
122 $valueArray = $result[
'databaseRow'][$fieldName];
124 if (!is_array($result[
'databaseRow'][$fieldName])) {
125 $valueArray = GeneralUtility::xml2array($result[
'databaseRow'][$fieldName]);
127 if (!is_array($valueArray)) {
130 if (!isset($valueArray[
'data'])) {
131 $valueArray[
'data'] = [];
133 if (!isset($valueArray[
'meta'])) {
134 $valueArray[
'meta'] = [];
136 $result[
'databaseRow'][$fieldName] = $valueArray;
153 $modifiedDataStructure = $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'];
155 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'] = $modifiedDataStructure;
168 foreach ($structure as $key => $value) {
169 if ($key ===
'ROOT' && is_array($value) && isset($value[
'TCEforms'])) {
170 $value = array_merge($value, $value[
'TCEforms']);
171 unset($value[
'TCEforms']);
173 if ($key ===
'el' && is_array($value)) {
174 $newSubStructure = [];
175 foreach ($value as $subKey => $subValue) {
176 if (is_array($subValue) && count($subValue) === 1 && isset($subValue[
'TCEforms'])) {
177 $newSubStructure[$subKey] = $subValue[
'TCEforms'];
179 $newSubStructure[$subKey] = $subValue;
182 $value = $newSubStructure;
184 if (is_array($value)) {
187 $newStructure[$key] = $value;
189 return $newStructure;
201 $modifiedDataStructure = $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'];
203 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'ds'] = $modifiedDataStructure;
218 foreach ($structure as $key => $value) {
219 if ($key ===
'el' && is_array($value)) {
220 $newSubStructure = [];
221 $tcaMigration = GeneralUtility::makeInstance(TcaMigration::class);
222 $tcaPreparation = GeneralUtility::makeInstance(TcaPreparation::class);
223 foreach ($value as $subKey => $subValue) {
229 'dummyField' => $subValue,
233 $migratedTca = $tcaMigration->migrate($dummyTca);
234 $messages = $tcaMigration->getMessages();
235 if (!empty($messages)) {
236 $context =
'FormEngine did an on-the-fly migration of a flex form data structure. This is deprecated and will be removed.'
237 .
' Merge the following changes into the flex form definition of table "' . $table .
'"" in field "' . $fieldName .
'"":';
238 array_unshift($messages, $context);
239 trigger_error(implode(LF, $messages), E_USER_DEPRECATED);
241 $preparedTca = $tcaPreparation->prepare($migratedTca);
242 $newSubStructure[$subKey] = $preparedTca[
'dummyTable'][
'columns'][
'dummyField'];
244 $value = $newSubStructure;
246 if (is_array($value)) {
249 $newStructure[$key] = $value;
251 return $newStructure;