‪TYPO3CMS  9.5
TcaMigration.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
20 
27 {
33  protected ‪$messages = [];
34 
48  public function ‪migrate(array ‪$tca): array
49  {
50  $this->‪validateTcaType($tca);
51 
52  ‪$tca = $this->‪migrateColumnsConfig($tca);
59  ‪$tca = $this->‪migrateIconsInOptionTags($tca);
65  ‪$tca = $this->‪migrateSelectTreeOptions($tca);
67  ‪$tca = $this->‪migrateShowIfRteOption($tca);
68  ‪$tca = $this->‪migrateWorkspacesOptions($tca);
69  ‪$tca = $this->‪migrateTranslationTable($tca);
73  ‪$tca = $this->‪migrateRequestUpdate($tca);
90  ‪$tca = $this->‪migrateinputDateTimeMax($tca);
96 
97  return ‪$tca;
98  }
99 
105  public function ‪getMessages(): array
106  {
107  return ‪$this->messages;
108  }
109 
115  protected function ‪validateTcaType(array ‪$tca)
116  {
117  foreach (‪$tca as $table => $tableDefinition) {
118  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
119  continue;
120  }
121  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
122  if (isset($fieldConfig['config']) && is_array($fieldConfig['config']) && empty($fieldConfig['config']['type'])) {
123  throw new \UnexpectedValueException(
124  'Missing "type" in TCA of field "[\'' . $table . '\'][\'' . $fieldName . '\'][\'config\']".',
125  1482394401
126  );
127  }
128  }
129  }
130  }
131 
139  protected function ‪migrateColumnsConfig(array ‪$tca): array
140  {
141  foreach (‪$tca as $table => &$tableDefinition) {
142  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
143  continue;
144  }
145  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
146  if ((!isset($fieldConfig['config']) || !is_array($fieldConfig['config'])) && !isset($fieldConfig['type'])) {
147  $fieldConfig['config'] = [
148  'type' => 'none',
149  ];
150  $this->messages[] = 'TCA table "' . $table . '" columns field "' . $fieldName . '"'
151  . ' had no mandatory "config" section. This has been added with default type "none":'
152  . ' TCA "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'type\'] = \'none\'"';
153  }
154  }
155  }
156  return ‪$tca;
157  }
158 
166  {
167  $newTca = ‪$tca;
168  foreach (‪$tca as $table => $tableDefinition) {
169  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
170  continue;
171  }
172  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
173  if (
174  !empty($fieldConfig['config']['type']) // type is set
175  && trim($fieldConfig['config']['type']) === 'text' // to "text"
176  && isset($fieldConfig['config']['wizards'])
177  && is_array($fieldConfig['config']['wizards']) // and there are wizards
178  ) {
179  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
180  if (
181  !empty($wizardConfig['userFunc']) // a userFunc is defined
182  && trim($wizardConfig['userFunc']) === 'TYPO3\\CMS\\T3editor\\FormWizard->main' // and set to FormWizard
183  && (
184  !isset($wizardConfig['enableByTypeConfig']) // and enableByTypeConfig is not set
185  || (isset($wizardConfig['enableByTypeConfig']) && !$wizardConfig['enableByTypeConfig']) // or set, but not enabled
186  )
187  ) {
188  // Set renderType from text to t3editor
189  $newTca[$table]['columns'][$fieldName]['config']['renderType'] = 't3editor';
190  // Unset this wizard definition
191  unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]);
192  // Move format parameter
193  if (!empty($wizardConfig['params']['format'])) {
194  $newTca[$table]['columns'][$fieldName]['config']['format'] = $wizardConfig['params']['format'];
195  }
196  $this->messages[] = 'The t3editor wizard using \'type\' = \'text\' has been migrated to a \'renderType\' = \'t3editor\' definition.'
197  . 'It has been migrated from TCA "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'t3editor\']"'
198  . 'to "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'t3editor\'"';
199  }
200  }
201  // If no wizard is left after migration, unset the whole sub array
202  if (empty($newTca[$table]['columns'][$fieldName]['config']['wizards'])) {
203  unset($newTca[$table]['columns'][$fieldName]['config']['wizards']);
204  }
205  }
206  }
207  }
208  return $newTca;
209  }
210 
219  {
220  $newTca = ‪$tca;
221  foreach (‪$tca as $table => $tableDefinition) {
222  if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) {
223  continue;
224  }
225  foreach ($tableDefinition['types'] as $typeName => $typeArray) {
226  if (!isset($typeArray['showitem']) || !is_string($typeArray['showitem']) || strpos($typeArray['showitem'], ';') === false) {
227  // Continue directly if no semicolon is found
228  continue;
229  }
230  $itemList = GeneralUtility::trimExplode(',', $typeArray['showitem'], true);
231  $newFieldStrings = [];
232  foreach ($itemList as $fieldString) {
233  $fieldString = rtrim($fieldString, ';');
234  // Unpack the field definition, migrate and remove as much as possible
235  // Keep empty parameters in trimExplode here (third parameter FALSE), so position is not changed
236  $fieldArray = GeneralUtility::trimExplode(';', $fieldString);
237  $fieldArray = [
238  'fieldName' => $fieldArray[0] ?? '',
239  'fieldLabel' => $fieldArray[1] ?? null,
240  'paletteName' => $fieldArray[2] ?? null,
241  'fieldExtra' => $fieldArray[3] ?? null,
242  ];
243  if (!empty($fieldArray['fieldExtra'])) {
244  // Move fieldExtra "specConf" to columnsOverrides "defaultExtras"
245  if (!isset($newTca[$table]['types'][$typeName]['columnsOverrides'])) {
246  $newTca[$table]['types'][$typeName]['columnsOverrides'] = [];
247  }
248  if (!isset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']])) {
249  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']] = [];
250  }
251  // Merge with given defaultExtras from columns.
252  // They will be the first part of the string, so if "specConf" from types changes the same settings,
253  // those will override settings from defaultExtras of columns
254  $newDefaultExtras = [];
255  if (!empty(‪$tca[$table]['columns'][$fieldArray['fieldName']]['defaultExtras'])) {
256  $newDefaultExtras[] = ‪$tca[$table]['columns'][$fieldArray['fieldName']]['defaultExtras'];
257  }
258  $newDefaultExtras[] = $fieldArray['fieldExtra'];
259  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldArray['fieldName']]['defaultExtras'] = implode(':', $newDefaultExtras);
260  }
261  unset($fieldArray['fieldExtra']);
262  if (count($fieldArray) === 3 && empty($fieldArray['paletteName'])) {
263  unset($fieldArray['paletteName']);
264  }
265  if (count($fieldArray) === 2 && empty($fieldArray['fieldLabel'])) {
266  unset($fieldArray['fieldLabel']);
267  }
268  $newFieldString = implode(';', $fieldArray);
269  if ($newFieldString !== $fieldString) {
270  $this->messages[] = 'The 4th parameter \'specConf\' of the field \'showitem\' with fieldName = \'' . $fieldArray['fieldName'] . '\' has been migrated, from TCA table "'
271  . $table . '[\'types\'][\'' . $typeName . '\'][\'showitem\']"' . 'to "'
272  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldArray['fieldName'] . '\'][\'defaultExtras\']".';
273  }
274  if (count($fieldArray) === 1 && empty($fieldArray['fieldName'])) {
275  // The field may vanish if nothing is left
276  unset($fieldArray['fieldName']);
277  }
278  if (!empty($newFieldString)) {
279  $newFieldStrings[] = $newFieldString;
280  }
281  }
282  $newTca[$table]['types'][$typeName]['showitem'] = implode(',', $newFieldStrings);
283  }
284  }
285  return $newTca;
286  }
287 
295  protected function migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides(array $tca): array
296  {
297  $newTca = $tca;
298  foreach ($tca as $table => $tableDefinition) {
299  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
300  continue;
301  }
302  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
303  if (
304  !empty($fieldConfig['config']['type']) // type is set
305  && trim($fieldConfig['config']['type']) === 'text' // to "text"
306  && isset($fieldConfig['config']['wizards'])
307  && is_array($fieldConfig['config']['wizards']) // and there are wizards
308  ) {
309  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
310  if (
311  !empty($wizardConfig['userFunc']) // a userFunc is defined
312  && trim($wizardConfig['userFunc']) === 'TYPO3\CMS\T3editor\FormWizard->main' // and set to FormWizard
313  && !empty($wizardConfig['enableByTypeConfig']) // and enableByTypeConfig is enabled
314  ) {
315  // Remove this wizard
316  unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]);
317  // Find configured types that use this wizard
318  if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) {
319  // No type definition at all ... continue directly
320  continue;
321  }
322  foreach ($tableDefinition['types'] as $typeName => $typeArray) {
323  if (
324  empty($typeArray['columnsOverrides'][$fieldName]['defaultExtras'])
325  || strpos($typeArray['columnsOverrides'][$fieldName]['defaultExtras'], $wizardName) === false
326  ) {
327  // Continue directly if this wizard is not enabled for given type
328  continue;
329  }
330  $defaultExtras = $typeArray['columnsOverrides'][$fieldName]['defaultExtras'];
331  $defaultExtrasArray = GeneralUtility::trimExplode(':', $defaultExtras, true);
332  $newDefaultExtrasArray = [];
333  foreach ($defaultExtrasArray as $fieldExtraField) {
334  // There might be multiple enabled wizards separated by | ... split them
335  if (strpos($fieldExtraField, 'wizards[') === 0) {
336  $enabledWizards = substr($fieldExtraField, 8, strlen($fieldExtraField) - 8); // Cut off "wizards[
337  $enabledWizards = substr($enabledWizards, 0, strlen($enabledWizards) - 1);
338  $enabledWizardsArray = GeneralUtility::trimExplode('|', $enabledWizards, true);
339  $newEnabledWizardsArray = [];
340  foreach ($enabledWizardsArray as $enabledWizardName) {
341  if ($enabledWizardName === $wizardName) {
342  // Found a columnsOverrides configuration that has this wizard enabled
343  // Force renderType = t3editor
344  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['renderType'] = 't3editor';
345  // Transfer format option if given
346  if (!empty($wizardConfig['params']['format'])) {
347  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['format'] = $wizardConfig['params']['format'];
348  }
349  $this->messages[] = 'The t3editor wizard using \'type\' = \'text\', with the "enableByTypeConfig" wizard set to 1,'
350  . 'has been migrated to the \'renderType\' = \'t3editor\' definition.'
351  . 'It has been migrated from TCA "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'t3editor\']"'
352  . 'to "' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'t3editor\'"';
353  } else {
354  // Some other enabled wizard
355  $newEnabledWizardsArray[] = $enabledWizardName;
356  }
357  }
358  if (!empty($newEnabledWizardsArray)) {
359  $newDefaultExtrasArray[] = 'wizards[' . implode('|', $newEnabledWizardsArray) . ']';
360  }
361  } else {
362  $newDefaultExtrasArray[] = $fieldExtraField;
363  }
364  }
365  if (!empty($newDefaultExtrasArray)) {
366  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras'] = implode(':', $newDefaultExtrasArray);
367  } else {
368  unset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras']);
369  }
370  }
371  }
372  }
373  // If no wizard is left after migration, unset the whole sub array
374  if (empty($newTca[$table]['columns'][$fieldName]['config']['wizards'])) {
375  unset($newTca[$table]['columns'][$fieldName]['config']['wizards']);
376  }
377  }
378  }
379  }
380  return $newTca;
381  }
382 
395  protected function migrateShowItemAdditionalPaletteToOwnPalette(array ‪$tca): array
396  {
397  $newTca = ‪$tca;
398  foreach (‪$tca as $table => $tableDefinition) {
399  if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) {
400  continue;
401  }
402  foreach ($tableDefinition['types'] as $typeName => $typeArray) {
403  if (
404  !isset($typeArray['showitem'])
405  || !is_string($typeArray['showitem'])
406  || strpos($typeArray['showitem'], ';') === false // no field parameters
407  ) {
408  continue;
409  }
410  $itemList = GeneralUtility::trimExplode(',', $typeArray['showitem'], true);
411  $newFieldStrings = [];
412  foreach ($itemList as $fieldString) {
413  $fieldArray = GeneralUtility::trimExplode(';', $fieldString);
414  $fieldArray = [
415  'fieldName' => $fieldArray[0] ?? '',
416  'fieldLabel' => $fieldArray[1] ?? null,
417  'paletteName' => $fieldArray[2] ?? null,
418  ];
419  if ($fieldArray['fieldName'] !== '--palette--' && $fieldArray['paletteName'] !== null) {
420  if ($fieldArray['fieldLabel']) {
421  $fieldString = $fieldArray['fieldName'] . ';' . $fieldArray['fieldLabel'];
422  } else {
423  $fieldString = $fieldArray['fieldName'];
424  }
425  $paletteString = '--palette--;;' . $fieldArray['paletteName'];
426  $this->messages[] = 'Migrated \'showitem\' field from TCA table '
427  . $table . '[\'types\'][\'' . $typeName . '\']" : Moved additional palette'
428  . ' with name "' . $table . '[\'types\'][\'' . $typeName . '\'][\'' . $fieldArray['paletteName'] . '\']" as 3rd argument of field "'
429  . $table . '[\'types\'][\'' . $typeName . '\'][\'' . $fieldArray['fieldName'] . '\']"'
430  . 'to an own palette. The result of this part is: "' . $fieldString . ', ' . $paletteString . '"';
431  $newFieldStrings[] = $fieldString;
432  $newFieldStrings[] = $paletteString;
433  } else {
434  $newFieldStrings[] = $fieldString;
435  }
436  }
437  $newTca[$table]['types'][$typeName]['showitem'] = implode(',', $newFieldStrings);
438  }
439  }
440  return $newTca;
441  }
442 
449  protected function migrateIconsForFormFieldWizardToNewLocation(array $tca): array
450  {
451  $newTca = $tca;
452 
453  $newFileLocations = [
454  'add.gif' => 'actions-add',
455  'link_popup.gif' => 'actions-wizard-link',
456  'wizard_rte2.gif' => 'actions-wizard-rte',
457  'wizard_table.gif' => 'content-table',
458  'edit2.gif' => 'actions-open',
459  'list.gif' => 'actions-system-list-open',
460  'wizard_forms.gif' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_forms.gif',
461  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_add.gif' => 'actions-add',
462  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_table.gif' => 'content-table',
463  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_edit.gif' => 'actions-open',
464  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_list.gif' => 'actions-system-list-open',
465  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif' => 'actions-wizard-link',
466  'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_rte.gif' => 'actions-wizard-rte'
467  ];
468  $oldFileNames = array_keys($newFileLocations);
469 
470  foreach ($tca as $table => $tableDefinition) {
471  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
472  continue;
473  }
474  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
475  if (
476  isset($fieldConfig['config']['wizards'])
477  && is_array($fieldConfig['config']['wizards']) // and there are wizards
478  ) {
479  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
480  if (!is_array($wizardConfig)) {
481  continue;
482  }
483 
484  foreach ($wizardConfig as $option => $value) {
485  if ($option === 'icon' && in_array($value, $oldFileNames, true)) {
486  $newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]['icon'] = $newFileLocations[$value];
487  $this->messages[] = 'The icon path of wizard "' . $wizardName
488  . '" from TCA table "'
489  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\'][\'icon\']"'
490  . 'has been migrated to '
491  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\'][\'icon\']" = \'' . $newFileLocations[$value] . '\'.';
492  }
493  }
494  }
495  }
496  }
497  }
498 
499  return $newTca;
500  }
501 
508  protected function migrateExtAndSysextPathToEXTPath(array $tca): array
509  {
510  foreach ($tca as $table => &$tableDefinition) {
511  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
512  continue;
513  }
514  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
515  if (
516  !empty($fieldConfig['config']['type']) // type is set
517  && trim($fieldConfig['config']['type']) === 'select' // to "select"
518  && isset($fieldConfig['config']['items'])
519  && is_array($fieldConfig['config']['items']) // and there are items
520  ) {
521  foreach ($fieldConfig['config']['items'] as &$itemConfig) {
522  // more then two values? then the third entry is the image path
523  if (!empty($itemConfig[2])) {
524  $tcaPath = implode('.', [$table, 'columns', $fieldName, 'config', 'items']);
525  $pathParts = GeneralUtility::trimExplode('/', $itemConfig[2]);
526  // remove first element (ext or sysext)
527  array_shift($pathParts);
528  $path = implode('/', $pathParts);
529  // If the path starts with ext/ or sysext/ migrate it
530  if (
531  strpos($itemConfig[2], 'ext/') === 0
532  || strpos($itemConfig[2], 'sysext/') === 0
533  ) {
534  $this->messages[] = '[' . $tcaPath . '] ext/ or sysext/ within the path (' . $path . ') in items array is deprecated, use EXT: reference';
535  $itemConfig[2] = 'EXT:' . $path;
536  } elseif (strpos($itemConfig[2], 'i/') === 0) {
537  $this->messages[] = '[' . $tcaPath . '] i/ within the path (' . $path . ') in items array is deprecated, use EXT: reference';
538  $itemConfig[2] = 'EXT:backend/Resources/Public/Images/' . substr($itemConfig[2], 2);
539  }
540  }
541  }
542  }
543  }
544  }
545  return ‪$tca;
546  }
547 
554  protected function migrateIconsInOptionTags(array ‪$tca): array
555  {
556  $newTca = ‪$tca;
557 
558  foreach ($newTca as $table => &$tableDefinition) {
559  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
560  continue;
561  }
562  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
563  if (isset($fieldConfig['config']['iconsInOptionTags'])) {
564  unset($fieldConfig['config']['iconsInOptionTags']);
565  $this->messages[] = 'Configuration option \'iconsInOptionTags\' was removed from field "' . $fieldName . '" in TCA table "' . $table . '[\'config\']"';
566  }
567  }
568  }
569 
570  return $newTca;
571  }
572 
579  protected function migrateIconfileRelativePathOrFilenameOnlyToExtReference(array ‪$tca): array
580  {
581  foreach (‪$tca as $table => &$tableDefinition) {
582  if (!isset($tableDefinition['ctrl']) || !is_array($tableDefinition['ctrl'])) {
583  continue;
584  }
585  if (!isset($tableDefinition['ctrl']['iconfile'])) {
586  continue;
587  }
588  if (strpos($tableDefinition['ctrl']['iconfile'], '../typo3conf/ext/') === 0) {
589  $tableDefinition['ctrl']['iconfile'] = str_replace('../typo3conf/ext/', 'EXT:', $tableDefinition['ctrl']['iconfile']);
590  $tcaPath = implode('.', [$table, 'ctrl', 'iconfile']);
591  $this->messages[] = '[' . $tcaPath . '] relative path to ../typo3conf/ext/ is deprecated, use EXT: instead';
592  } elseif (strpos($tableDefinition['ctrl']['iconfile'], '/') === false) {
593  $tableDefinition['ctrl']['iconfile'] = 'EXT:backend/Resources/Public/Images/' . $tableDefinition['ctrl']['iconfile'];
594  $tcaPath = implode('.', [$table, 'ctrl', 'iconfile']);
595  $this->messages[] = '[' . $tcaPath . '] filename only is deprecated, use EXT: or absolute reference instead';
596  }
597  }
598  return ‪$tca;
599  }
600 
609  public function migrateSelectFieldRenderType(array ‪$tca): array
610  {
611  $newTca = ‪$tca;
612 
613  foreach ($newTca as $table => &$tableDefinition) {
614  if (empty($tableDefinition['columns'])) {
615  continue;
616  }
617 
618  foreach ($tableDefinition['columns'] as $columnName => &$columnDefinition) {
619  // Only handle select fields.
620  if (empty($columnDefinition['config']['type']) || $columnDefinition['config']['type'] !== 'select') {
621  continue;
622  }
623  // Do not handle field where the render type is set.
624  if (!empty($columnDefinition['config']['renderType'])) {
625  continue;
626  }
627 
628  $tableColumnInfo = 'table "' . $table . '[\'columns\'][\'' . $columnName . '\']"';
629  $this->messages[] = 'Using the \'type\' = \'select\' field in "' . $table . '[\'columns\'][\'' . $columnName . '\'][\'config\'][\'type\'] = \'select\'" without the "renderType" setting in "'
630  . $table . '[\'columns\'][\'' . $columnName . '\'][\'config\'][\'renderType\']" is deprecated.';
631 
632  $columnConfig = &$columnDefinition['config'];
633  if (!empty($columnConfig['renderMode'])) {
634  $this->messages[] = 'The "renderMode" setting for select fields is deprecated. Please use "renderType" instead in ' . $tableColumnInfo;
635  switch ($columnConfig['renderMode']) {
636  case 'tree':
637  $columnConfig['renderType'] = 'selectTree';
638  break;
639  case 'singlebox':
640  $columnConfig['renderType'] = 'selectSingleBox';
641  break;
642  case 'checkbox':
643  $columnConfig['renderType'] = 'selectCheckBox';
644  break;
645  default:
646  $this->messages[] = 'The render mode ' . $columnConfig['renderMode'] . ' is invalid for the select field in ' . $tableColumnInfo;
647  }
648  continue;
649  }
650 
651  $maxItems = !empty($columnConfig['maxitems']) ? (int)$columnConfig['maxitems'] : 1;
652  if ($maxItems <= 1) {
653  $columnConfig['renderType'] = 'selectSingle';
654  } else {
655  $columnConfig['renderType'] = 'selectMultipleSideBySide';
656  }
657  }
658  }
659 
660  return $newTca;
661  }
662 
669  public function migrateSelectFieldIconTable(array ‪$tca): array
670  {
671  foreach (‪$tca as $table => &$tableDefinition) {
672  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
673  continue;
674  }
675  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
676  if (empty($fieldConfig['config']['renderType']) || $fieldConfig['config']['renderType'] !== 'selectSingle') {
677  continue;
678  }
679  if (array_key_exists('noIconsBelowSelect', $fieldConfig['config'])) {
680  $this->messages[] = 'The "noIconsBelowSelect" setting for select fields in table "'
681  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" in table "'
682  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"';
683  if (!$fieldConfig['config']['noIconsBelowSelect']) {
684  // If old setting was explicitly false, enable icon table if not defined yet
685  if (!array_key_exists('showIconTable', $fieldConfig['config'])) {
686  $fieldConfig['config']['showIconTable'] = true;
687  }
688  }
689  unset($fieldConfig['config']['noIconsBelowSelect']);
690  }
691  if (array_key_exists('suppress_icons', $fieldConfig['config'])) {
692  $this->messages[] = 'The "suppress_icons" setting for select fields in table "'
693  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" for table "'
694  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"';
695  unset($fieldConfig['config']['suppress_icons']);
696  }
697  if (array_key_exists('foreign_table_loadIcons', $fieldConfig['config'])) {
698  $this->messages[] = 'The "foreign_table_loadIcons" setting for select fields in table "'
699  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']" was removed. Please define the setting "showIconTable" for table "'
700  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'showIconTable\']"';
701  unset($fieldConfig['config']['foreign_table_loadIcons']);
702  }
703  }
704  }
705  return ‪$tca;
706  }
707 
714  protected function migrateElementBrowserWizardToLinkHandler(array ‪$tca): array
715  {
716  foreach (‪$tca as $table => &$tableDefinition) {
717  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
718  continue;
719  }
720  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
721  if (
722  isset($fieldConfig['config']['wizards']['link']['module']['name']) && $fieldConfig['config']['wizards']['link']['module']['name'] === 'wizard_element_browser'
723  && isset($fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode']) && $fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode'] === 'wizard'
724  ) {
725  $fieldConfig['config']['wizards']['link']['module']['name'] = 'wizard_link';
726  unset($fieldConfig['config']['wizards']['link']['module']['urlParameters']['mode']);
727  if (empty($fieldConfig['config']['wizards']['link']['module']['urlParameters'])) {
728  unset($fieldConfig['config']['wizards']['link']['module']['urlParameters']);
729  }
730  $this->messages[] = 'Reference to "wizard_element_browser" was migrated from "'
731  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'link\'][\'module\'][\'name\'] === \'wizard_element_browser\'"'
732  . ' to new "wizard_link", "'
733  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'link\'][\'module\'][\'name\'] = \'wizard_link\'"';
734  }
735  }
736  }
737  return ‪$tca;
738  }
739 
747  protected function migrateDefaultExtrasRteTransFormOptions(array ‪$tca): array
748  {
749  foreach (‪$tca as $table => &$tableDefinition) {
750  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
751  continue;
752  }
753  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
754  if (isset($fieldConfig['defaultExtras'])) {
755  $originalValue = $fieldConfig['defaultExtras'];
756  $defaultExtrasArray = GeneralUtility::trimExplode(':', $originalValue, true);
757  $isRichtextField = false;
758  foreach ($defaultExtrasArray as $defaultExtrasField) {
759  if (strpos($defaultExtrasField, 'richtext') === 0) {
760  $isRichtextField = true;
761  $fieldConfig['config']['enableRichtext'] = true;
762  $fieldConfig['config']['richtextConfiguration'] = 'default';
763  }
764  }
765  if ($isRichtextField) {
766  unset($fieldConfig['defaultExtras']);
767  $this->messages[] = 'RTE configuration via \'defaultExtras\' options are deprecated. String "' . $originalValue . '" in TCA'
768  . ' ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'defaultExtras\'] was changed to'
769  . ' options in ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
770  }
771  }
772  }
773  }
774 
775  foreach (‪$tca as $table => &$tableDefinition) {
776  if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) {
777  continue;
778  }
779  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
780  if (!isset($typeArray['columnsOverrides']) || !is_array($typeArray['columnsOverrides'])) {
781  continue;
782  }
783  foreach ($typeArray['columnsOverrides'] as $fieldName => &$fieldConfig) {
784  if (isset($fieldConfig['defaultExtras'])) {
785  $originalValue = $fieldConfig['defaultExtras'];
786  $defaultExtrasArray = GeneralUtility::trimExplode(':', $originalValue, true);
787  $isRichtextField = false;
788  foreach ($defaultExtrasArray as $defaultExtrasField) {
789  if (strpos($defaultExtrasField, 'richtext') === 0) {
790  $isRichtextField = true;
791  $fieldConfig['config']['enableRichtext'] = true;
792  $fieldConfig['config']['richtextConfiguration'] = 'default';
793  }
794  }
795  if ($isRichtextField) {
796  unset($fieldConfig['defaultExtras']);
797  $this->messages[] = 'RTE configuration via \'defaultExtras\' options are deprecated. String "' . $originalValue . '" in TCA'
798  . ' ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'defaultExtras\']' .
799  ' was changed to options in ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
800  }
801  }
802  }
803  }
804  }
805 
806  return ‪$tca;
807  }
808 
815  protected function migrateSelectTreeOptions(array ‪$tca): array
816  {
817  foreach (‪$tca as $table => &$tableDefinition) {
818  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
819  continue;
820  }
821  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
822  if (isset($fieldConfig['config']['renderType']) && $fieldConfig['config']['renderType'] === 'selectTree') {
823  if (isset($fieldConfig['config']['treeConfig']['appearance']['width'])) {
824  $this->messages[] = 'The selectTree field [\'treeConfig\'][\'appearance\'][\'width\'] setting is deprecated'
825  . ' and was removed in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
826  . '[\'treeConfig\'][\'appearance\'][\'width\'] ';
827  unset($fieldConfig['config']['treeConfig']['appearance']['width']);
828  }
829 
830  if (isset($fieldConfig['config']['treeConfig']['appearance']['allowRecursiveMode'])) {
831  $this->messages[] = 'The selectTree field [\'treeConfig\'][\'appearance\'][\'allowRecursiveMode\'] setting is deprecated'
832  . ' and was removed in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
833  . '[\'treeConfig\'][\'appearance\'][\'allowRecursiveMode\'] ';
834  unset($fieldConfig['config']['treeConfig']['appearance']['allowRecursiveMode']);
835  }
836 
837  if (isset($fieldConfig['config']['autoSizeMax'])) {
838  $this->messages[] = 'The selectTree field [\'autoSizeMax\'] setting is deprecated'
839  . ' and was removed in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'autoSizeMax\'].'
840  . ' The \'size\' value was adapted to the previous autoSizeMax value';
841  $fieldConfig['config']['size'] = $fieldConfig['config']['autoSizeMax'];
842  unset($fieldConfig['config']['autoSizeMax']);
843  }
844  }
845  }
846  }
847  return ‪$tca;
848  }
849 
856  protected function migrateTSconfigSoftReferences(array ‪$tca): array
857  {
858  foreach (‪$tca as $table => &$tableDefinition) {
859  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
860  continue;
861  }
862  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
863  if (isset($fieldConfig['config'])) {
864  if (isset($fieldConfig['config']['softref'])) {
865  $softReferences = array_flip(GeneralUtility::trimExplode(',', $fieldConfig['config']['softref']));
866  $changed = false;
867  if (isset($softReferences['TSconfig'])) {
868  $changed = true;
869  unset($softReferences['TSconfig']);
870  }
871  if (isset($softReferences['TStemplate'])) {
872  $changed = true;
873  unset($softReferences['TStemplate']);
874  }
875  if ($changed) {
876  if (!empty($softReferences)) {
877  $softReferences = array_flip($softReferences);
878  $fieldConfig['config']['softref'] = implode(',', $softReferences);
879  } else {
880  unset($fieldConfig['config']['softref']);
881  }
882  $this->messages[] = 'The soft reference setting using \'TSconfig\' and '
883  . '\'TStemplate\' was removed in TCA ' . $table . '[\'columns\']'
884  . '[\'' . $fieldName . '\'][\'config\'][\'softref\']';
885  }
886  }
887  }
888  }
889  }
890  return ‪$tca;
891  }
892 
899  protected function migrateShowIfRteOption(array ‪$tca): array
900  {
901  foreach (‪$tca as $table => &$tableDefinition) {
902  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
903  continue;
904  }
905  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
906  if (isset($fieldConfig['config']) && $fieldConfig['config']['type'] === 'check') {
907  if (isset($fieldConfig['config']['showIfRTE'])) {
908  unset($fieldConfig['config']['showIfRTE']);
909  $this->messages[] = 'The TCA setting \'showIfRTE\' was removed '
910  . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
911  }
912  }
913  }
914  }
915  return ‪$tca;
916  }
917 
924  protected function migrateWorkspacesOptions(array ‪$tca): array
925  {
926  foreach (‪$tca as $table => &$tableDefinition) {
927  if (isset($tableDefinition['ctrl']['versioningWS']) && !is_bool($tableDefinition['ctrl']['versioningWS'])) {
928  $tableDefinition['ctrl']['versioningWS'] = (bool)$tableDefinition['ctrl']['versioningWS'];
929  $this->messages[] = 'The TCA setting \'versioningWS\' was set to a boolean value '
930  . 'in TCA ' . $table . '[\'ctrl\'][\'versioningWS\']';
931  }
932  if (isset($tableDefinition['ctrl']['versioning_followPages']) && !empty($tableDefinition['ctrl']['versioning_followPages'])) {
933  unset($tableDefinition['ctrl']['versioning_followPages']);
934  $this->messages[] = 'The TCA setting \'versioning_followPages\' was removed as it is unused '
935  . 'in TCA ' . $table . '[\'ctrl\'][\'versioning_followPages\']';
936  }
937  }
938  return ‪$tca;
939  }
940 
948  protected function migrateTranslationTable(array ‪$tca): array
949  {
950  foreach (‪$tca as $table => &$tableDefinition) {
951  if (!empty($tableDefinition['ctrl']['transForeignTable'])) {
952  unset($tableDefinition['ctrl']['transForeignTable']);
953  $this->messages[] = 'The TCA setting \'transForeignTable\' was removed '
954  . 'in TCA ' . $table . '[\'ctrl\'][\'transForeignTable\']';
955  }
956  if (!empty($tableDefinition['ctrl']['transOrigPointerTable'])) {
957  unset($tableDefinition['ctrl']['transOrigPointerTable']);
958  $this->messages[] = 'The TCA setting \'transOrigPointerTable\' was removed '
959  . 'in TCA ' . $table . '[\'ctrl\'][\'transOrigPointerTable\']';
960  }
961  }
962  return ‪$tca;
963  }
964 
971  protected function migrateL10nModeDefinitions(array ‪$tca)
972  {
973  foreach (‪$tca as $table => &$tableDefinition) {
974  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
975  continue;
976  }
977  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
978  if (empty($fieldConfig['l10n_mode'])) {
979  continue;
980  }
981  if ($fieldConfig['l10n_mode'] === 'noCopy') {
982  unset($fieldConfig['l10n_mode']);
983  $this->messages[] = 'The TCA setting \'noCopy\' was removed '
984  . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'l10n_mode\']';
985  }
986  if (!empty($fieldConfig['l10n_mode']) && $fieldConfig['l10n_mode'] === 'mergeIfNotBlank') {
987  unset($fieldConfig['l10n_mode']);
988  if (empty($fieldConfig['config']['behaviour']['allowLanguageSynchronization'])) {
989  $fieldConfig['config']['behaviour']['allowLanguageSynchronization'] = true;
990  }
991  $this->messages[] = 'The TCA setting \'mergeIfNotBlank\' was removed '
992  . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'l10n_mode\']'
993  . ' and changed to ' . $table . '[\'columns\'][\'' . $fieldName . '\']'
994  . '[\'config\'][\'behaviour\'][\'allowLanguageSynchronization\'] = true';
995  }
996  }
997  }
998  return ‪$tca;
999  }
1000 
1008  protected function migratePageLocalizationDefinitions(array ‪$tca)
1009  {
1010  if (
1011  empty(‪$tca['pages_language_overlay']['columns'])
1012  ) {
1013  return ‪$tca;
1014  }
1015 
1016  // ensure, that localization settings are defined for
1017  // pages and not for pages_language_overlay
1018  foreach (‪$tca['pages_language_overlay']['columns'] as $fieldName => &$fieldConfig) {
1019  $l10nMode = $fieldConfig['l10n_mode'] ?? null;
1020  $allowLanguageSynchronization = $fieldConfig['config']['behaviour']['allowLanguageSynchronization'] ?? null;
1021 
1022  $oppositeFieldConfig = ‪$tca['pages']['columns'][$fieldName] ?? [];
1023  $oppositeL10nMode = $oppositeFieldConfig['l10n_mode'] ?? null;
1024  $oppositeAllowLanguageSynchronization = $oppositeFieldConfig['config']['behaviour']['allowLanguageSynchronization'] ?? null;
1025 
1026  if ($l10nMode !== null) {
1027  if (!empty($oppositeFieldConfig) && $oppositeL10nMode !== 'exclude') {
1028  ‪$tca['pages']['columns'][$fieldName]['l10n_mode'] = $l10nMode;
1029  $this->messages[] = 'The TCA setting \'l10n_mode\' was migrated '
1030  . 'to TCA pages[\'columns\'][\'' . $fieldName . '\'][\'l10n_mode\'] '
1031  . 'from TCA pages_language_overlay[\'columns\'][\'' . $fieldName . '\'][\'l10n_mode\']';
1032  }
1033  }
1034 
1035  if (!empty($allowLanguageSynchronization) && empty($oppositeAllowLanguageSynchronization)) {
1036  ‪$tca['pages']['columns'][$fieldName]['config']['behaviour']['allowLanguageSynchronization'] = (bool)$allowLanguageSynchronization;
1037  $this->messages[] = 'The TCA setting \'allowLanguageSynchronization\' was migrated '
1038  . 'to TCA pages[\'columns\'][\'' . $fieldName . '\']'
1039  . '[\'config\'][\'behaviour\'][\'allowLanguageSynchronization\'] '
1040  . 'from TCA pages_language_overlay[\'columns\'][\'' . $fieldName . '\']'
1041  . '[\'config\'][\'behaviour\'][\'allowLanguageSynchronization\']';
1042  }
1043  }
1044 
1045  return ‪$tca;
1046  }
1047 
1056  protected function migrateInlineLocalizationMode(array ‪$tca)
1057  {
1058  foreach (‪$tca as $table => &$tableDefinition) {
1059  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
1060  continue;
1061  }
1062  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1063  if (($fieldConfig['config']['type'] ?? null) !== 'inline') {
1064  continue;
1065  }
1066 
1067  $inlineLocalizationMode = ($fieldConfig['config']['behaviour']['localizationMode'] ?? null);
1068  if ($inlineLocalizationMode === null) {
1069  continue;
1070  }
1071 
1072  $allowLanguageSynchronization = ($fieldConfig['config']['behaviour']['allowLanguageSynchronization'] ?? null);
1073  if ($inlineLocalizationMode === 'keep' && $allowLanguageSynchronization) {
1074  unset($fieldConfig['config']['behaviour']['localizationMode']);
1075  $this->messages[] = 'The TCA setting \'localizationMode\' is counter-productive '
1076  . ' if being used in combination with \'allowLanguageSynchronization\' and '
1077  . ' thus has been removed from TCA for ' . $table . '[\'columns\']'
1078  . '[\'' . $fieldName . '\'][\'config\'][\'behaviour\'][\'localizationMode\']';
1079  } else {
1080  $this->messages[] = 'The TCA setting \'localizationMode\' is deprecated '
1081  . ' and should be removed from TCA for ' . $table . '[\'columns\']'
1082  . '[\'' . $fieldName . '\'][\'config\'][\'behaviour\'][\'localizationMode\']';
1083  }
1084  }
1085  }
1086  return ‪$tca;
1087  }
1088 
1095  protected function migrateRequestUpdate(array ‪$tca): array
1096  {
1097  foreach (‪$tca as $table => &$tableDefinition) {
1098  if (!empty($tableDefinition['ctrl']['requestUpdate'])) {
1099  ‪$fields = GeneralUtility::trimExplode(',', $tableDefinition['ctrl']['requestUpdate']);
1100  foreach (‪$fields as $field) {
1101  if (isset($tableDefinition['columns'][$field])) {
1102  $tableDefinition['columns'][$field]['onChange'] = 'reload';
1103  }
1104  }
1105  $this->messages[] = 'The TCA setting [\'ctrl\'][\'requestUpdate\'] was removed from '
1106  . ' table ' . $table . '. The column field(s) "' . implode('" and "', ‪$fields) . '" were updated'
1107  . ' and contain option "\'onChange\' => \'reload\'" parallel to \'config\' and \'label\' section.';
1108  unset($tableDefinition['ctrl']['requestUpdate']);
1109  }
1110  }
1111  return ‪$tca;
1112  }
1113 
1120  protected function migrateInputDateTimeToRenderType(array ‪$tca): array
1121  {
1122  foreach (‪$tca as $table => &$tableDefinition) {
1123  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
1124  continue;
1125  }
1126  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1127  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] !== 'input') {
1128  continue;
1129  }
1130  $eval = $fieldConfig['config']['eval'] ?? '';
1131  $eval = GeneralUtility::trimExplode(',', $eval, true);
1132  if (in_array('date', $eval, true)
1133  || in_array('datetime', $eval, true)
1134  || in_array('time', $eval, true)
1135  || in_array('timesec', $eval, true)
1136  ) {
1137  if (!isset($fieldConfig['config']['renderType'])) {
1138  $fieldConfig['config']['renderType'] = 'inputDateTime';
1139  $this->messages[] = 'The TCA setting \'renderType\' => \'inputDateTime\' was added '
1140  . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
1141  }
1142  }
1143  }
1144  }
1145  return ‪$tca;
1146  }
1147 
1156  public function migrateWizardEnableByTypeConfigToColumnsOverrides(array ‪$tca): array
1157  {
1158  $newTca = ‪$tca;
1159  foreach (‪$tca as $table => $tableDefinition) {
1160  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
1161  continue;
1162  }
1163  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
1164  if (
1165  !empty($fieldConfig['config']['type']) // type is set
1166  && isset($fieldConfig['config']['wizards'])
1167  && is_array($fieldConfig['config']['wizards']) // and there are wizards
1168  ) {
1169  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1170  if (isset($wizardConfig['enableByTypeConfig']) // and enableByTypeConfig is given
1171  && $wizardConfig['enableByTypeConfig'] // and enabled
1172  ) { // and enableByTypeConfig is enabled
1173  // Remove this "enableByTypeConfig" wizard from columns
1174  unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]);
1175  if (!isset($tableDefinition['types']) || !is_array($tableDefinition['types'])) {
1176  // No type definition at all ... continue directly
1177  continue;
1178  }
1179  foreach ($tableDefinition['types'] as $typeName => $typeArray) {
1180  if (empty($typeArray['columnsOverrides'][$fieldName]['defaultExtras'])
1181  || strpos($typeArray['columnsOverrides'][$fieldName]['defaultExtras'], $wizardName) === false
1182  ) {
1183  // Continue directly if this wizard is not enabled for given type
1184  continue;
1185  }
1186  $defaultExtras = $typeArray['columnsOverrides'][$fieldName]['defaultExtras'];
1187  $defaultExtrasArray = GeneralUtility::trimExplode(':', $defaultExtras, true);
1188  $newDefaultExtrasArray = [];
1189  foreach ($defaultExtrasArray as $fieldExtraField) {
1190  if (strpos($fieldExtraField, 'wizards[') === 0) {
1191  $enabledWizards = substr($fieldExtraField, 8, strlen($fieldExtraField) - 8); // Cut off "wizards[
1192  $enabledWizards = substr($enabledWizards, 0, strlen($enabledWizards) - 1);
1193  $enabledWizardsArray = GeneralUtility::trimExplode('|', $enabledWizards, true);
1194  foreach ($enabledWizardsArray as $enabledWizardName) {
1195  if ($enabledWizardName === $wizardName) {
1196  // Fill new array
1197  unset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras']);
1198  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['wizards'][$enabledWizardName] = $wizardConfig;
1199  unset($newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['config']['wizards'][$enabledWizardName]['enableByTypeConfig']);
1200  $this->messages[] = 'The wizard with "enableByTypeConfig" set to 1 has been migrated to \'columnsOverrides\'.'
1201  . ' It has been migrated from "'
1202  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']" to '
1203  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\'].';
1204  }
1205  }
1206  } else {
1207  $newDefaultExtrasArray[] = $fieldExtraField;
1208  }
1209  }
1210  if ($defaultExtrasArray !== $newDefaultExtrasArray
1211  && !empty($newDefaultExtrasArray)
1212  ) {
1213  $newTca[$table]['types'][$typeName]['columnsOverrides'][$fieldName]['defaultExtras'] = implode(':', $newDefaultExtrasArray);
1214  }
1215  }
1216  } elseif (isset($wizardConfig['enableByTypeConfig'])) {
1217  // enableByTypeConfig is set, but not true or 1 or '1', just delete it.
1218  unset($newTca[$table]['columns'][$fieldName]['config']['wizards'][$wizardName]['enableByTypeConfig']);
1219  }
1220  }
1221  }
1222  }
1223  }
1224  return $newTca;
1225  }
1226 
1233  protected function migrateColorPickerWizardToRenderType(array $tca): array
1234  {
1235  foreach ($tca as $table => &$tableDefinition) {
1236  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1237  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1238  if (isset($fieldConfig['config'])) {
1239  // Do not handle field where the render type is set.
1240  if (!empty($fieldConfig['config']['renderType'])) {
1241  continue;
1242  }
1243  if ($fieldConfig['config']['type'] === 'input') {
1244  if (isset($fieldConfig['config']['wizards']) && is_array($fieldConfig['config']['wizards'])) {
1245  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizard) {
1246  if (isset($wizard['type']) && ($wizard['type'] === 'colorbox')) {
1247  unset($fieldConfig['config']['wizards'][$wizardName]);
1248  if (empty($fieldConfig['config']['wizards'])) {
1249  unset($fieldConfig['config']['wizards']);
1250  }
1251  $fieldConfig['config']['renderType'] = 'colorpicker';
1252  $this->messages[] = 'The color-picker wizard using \'colorbox\' is deprecated'
1253  . ' in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
1254  . '[\'wizards\'][\'' . $wizardName . '\'] and was changed to ' . $table
1255  . '[\'columns\'][\'' . $fieldName . '\'][\'config\'] = \'colorpicker\'';
1256  }
1257  }
1258  }
1259  if (empty($fieldConfig['config']['wizards'])) {
1260  unset($fieldConfig['config']['wizards']);
1261  }
1262  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1263  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1264  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1265  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1266  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1267  ) {
1268  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1269  if (isset($wizard['type']) && ($wizard['type'] === 'colorbox')) {
1270  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1271  $typeArray['columnsOverrides'][$fieldName]['config']['type'] = 'input';
1272  $typeArray['columnsOverrides'][$fieldName]['config']['renderType'] = 'colorpicker';
1273  $this->messages[] = 'The color-picker wizard in columnsOverrides using \'colorbox\' has been migrated to a \'rendertype\' = \'colorpicker\'.'
1274  . ' It has been migrated from TCA "' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1275  . '[\'wizards\'][\'' . $wizardName . '\'][\'type\'] = \'colorbox\'"" to "' . $table
1276  . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'renderType\'] = \'colorpicker\'"';
1277  }
1278  }
1279  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1280  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1281  }
1282  }
1283  }
1284  }
1285  }
1286  }
1287  }
1288  }
1289  }
1290  }
1291 
1292  return ‪$tca;
1293  }
1294 
1301  protected function migrateSelectWizardToValuePicker(array ‪$tca): array
1302  {
1303  foreach (‪$tca as $table => &$tableDefinition) {
1304  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1305  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1306  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'input' || $fieldConfig['config']['type'] === 'text')) {
1307  if (isset($fieldConfig['config']['wizards']) && is_array($fieldConfig['config']['wizards'])) {
1308  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1309  if (isset($wizardConfig['type'])
1310  && $wizardConfig['type'] === 'select'
1311  && isset($wizardConfig['items'])
1312  && is_array($wizardConfig['items'])
1313  ) {
1314  $fieldConfig['config']['valuePicker']['items'] = $wizardConfig['items'];
1315  if (isset($wizardConfig['mode'])
1316  && is_string($wizardConfig['mode'])
1317  && in_array($wizardConfig['mode'], ['append', 'prepend', ''])
1318  ) {
1319  $fieldConfig['config']['valuePicker']['mode'] = $wizardConfig['mode'];
1320  }
1321  unset($fieldConfig['config']['wizards'][$wizardName]);
1322  $this->messages[] = 'The select wizard in TCA '
1323  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
1324  . ' has been migrated to '
1325  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'valuePicker\'].';
1326  }
1327  }
1328  }
1329  if (empty($fieldConfig['config']['wizards'])) {
1330  unset($fieldConfig['config']['wizards']);
1331  }
1332  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1333  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1334  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1335  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1336  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1337  ) {
1338  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1339  if (isset($wizard['type'])
1340  && ($wizard['type'] === 'select')
1341  && isset($wizard['items'])
1342  && is_array($wizard['items'])
1343  ) {
1344  $typeArray['columnsOverrides'][$fieldName]['config']['valuePicker'] = $wizard;
1345  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1346  unset($typeArray['columnsOverrides'][$fieldName]['config']['valuePicker']['type']);
1347  $this->messages[] = 'The select wizard in columnsOverrides using \'type\' = \'select\' has been migrated'
1348  . ' from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1349  . '[\'wizards\'][\'' . $wizardName . '\'] to ' . $table
1350  . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'valuePicker\']';
1351  }
1352  }
1353  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1354  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1355  }
1356  }
1357  }
1358  }
1359  }
1360  }
1361  }
1362  }
1363  }
1364  return ‪$tca;
1365  }
1366 
1373  protected function migrateSliderWizardToSliderConfiguration(array ‪$tca): array
1374  {
1375  foreach (‪$tca as $table => &$tableDefinition) {
1376  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1377  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1378  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'input') {
1379  if (isset($fieldConfig['config']['wizards'])
1380  && is_array($fieldConfig['config']['wizards'])) {
1381  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1382  if (isset($wizardConfig['type']) && $wizardConfig['type'] === 'slider') {
1383  $fieldConfig['config']['slider'] = [];
1384  if (isset($wizardConfig['width'])) {
1385  $fieldConfig['config']['slider']['width'] = $wizardConfig['width'];
1386  }
1387  if (isset($wizardConfig['step'])) {
1388  $fieldConfig['config']['slider']['step'] = $wizardConfig['step'];
1389  }
1390  unset($fieldConfig['config']['wizards'][$wizardName]);
1391  $this->messages[] = 'The slider wizard in TCA '
1392  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
1393  . ' has been migrated to '
1394  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'slider\'].';
1395  }
1396  }
1397  }
1398  if (empty($fieldConfig['config']['wizards'])) {
1399  unset($fieldConfig['config']['wizards']);
1400  }
1401  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1402  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1403  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1404  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1405  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1406  ) {
1407  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1408  if (isset($wizard['type']) && ($wizard['type'] === 'slider')) {
1409  $typeArray['columnsOverrides'][$fieldName]['config']['slider'] = $wizard;
1410  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1411  unset($typeArray['columnsOverrides'][$fieldName]['config']['slider']['type']);
1412  $this->messages[] = 'The slider wizard in columnsOverrides using \'type\' = \'slider\' has been migrated'
1413  . ' from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1414  . '[\'wizards\'][\'' . $wizardName . '\'] to ' . $table
1415  . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'slider\']';
1416  }
1417  }
1418  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1419  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1420  }
1421  }
1422  }
1423  }
1424  }
1425  }
1426  }
1427  }
1428  }
1429  return ‪$tca;
1430  }
1431 
1438  protected function migrateLinkWizardToRenderTypeAndFieldControl(array ‪$tca): array
1439  {
1440  foreach (‪$tca as $table => &$tableDefinition) {
1441  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1442  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1443  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'input'
1444  && !isset($fieldConfig['config']['renderType'])
1445  ) {
1446  if (isset($fieldConfig['config']['wizards'])
1447  && is_array($fieldConfig['config']['wizards'])) {
1448  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1449  if (isset($wizardConfig['type'])
1450  && $wizardConfig['type'] === 'popup'
1451  && isset($wizardConfig['module']['name'])
1452  && $wizardConfig['module']['name'] === 'wizard_link'
1453  ) {
1454  $fieldConfig['config']['renderType'] = 'inputLink';
1455  if (isset($wizardConfig['title'])) {
1456  $fieldConfig['config']['fieldControl']['linkPopup']['options']['title'] = $wizardConfig['title'];
1457  }
1458  if (isset($wizardConfig['JSopenParams'])) {
1459  $fieldConfig['config']['fieldControl']['linkPopup']['options']['windowOpenParameters']
1460  = $wizardConfig['JSopenParams'];
1461  }
1462  if (isset($wizardConfig['params']['blindLinkOptions'])) {
1463  $fieldConfig['config']['fieldControl']['linkPopup']['options']['blindLinkOptions']
1464  = $wizardConfig['params']['blindLinkOptions'];
1465  }
1466  if (isset($wizardConfig['params']['blindLinkFields'])) {
1467  $fieldConfig['config']['fieldControl']['linkPopup']['options']['blindLinkFields']
1468  = $wizardConfig['params']['blindLinkFields'];
1469  }
1470  if (isset($wizardConfig['params']['allowedExtensions'])) {
1471  $fieldConfig['config']['fieldControl']['linkPopup']['options']['allowedExtensions']
1472  = $wizardConfig['params']['allowedExtensions'];
1473  }
1474  unset($fieldConfig['config']['wizards'][$wizardName]);
1475  $this->messages[] = 'The link wizard has been migrated to a \'renderType\' => \'inputLink \'. '
1476  . 'It has been migrated from TCA table "'
1477  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']" to "'
1478  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'inputLink\'".';
1479  }
1480  }
1481  }
1482  if (empty($fieldConfig['config']['wizards'])) {
1483  unset($fieldConfig['config']['wizards']);
1484  }
1485  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1486  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1487  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1488  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1489  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1490  ) {
1491  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1492  if (isset($wizard['type'])
1493  && $wizard['type'] === 'popup'
1494  && isset($wizard['module']['name'])
1495  && $wizard['module']['name'] === 'wizard_link'
1496  ) {
1497  $typeArray['columnsOverrides'][$fieldName]['config']['renderType'] = 'inputLink';
1498  if (isset($wizard['title'])) {
1499  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['linkPopup']['options']['title'] = $wizard['title'];
1500  }
1501  if (isset($wizard['JSopenParams'])) {
1502  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['linkPopup']['options']['windowOpenParameters']
1503  = $wizard['JSopenParams'];
1504  }
1505  if (isset($wizard['params']['blindLinkOptions'])) {
1506  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['linkPopup']['options']['blindLinkOptions']
1507  = $wizard['params']['blindLinkOptions'];
1508  }
1509  if (isset($wizard['params']['blindLinkFields'])) {
1510  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['linkPopup']['options']['blindLinkFields']
1511  = $wizard['params']['blindLinkFields'];
1512  }
1513  if (isset($wizard['params']['allowedExtensions'])) {
1514  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['linkPopup']['options']['allowedExtensions']
1515  = $wizard['params']['allowedExtensions'];
1516  }
1517  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1518  $this->messages[] = 'The link wizard in columnsOverrides using \'type\' = \'popup\' has been migrated to a \'renderType\' = \'inputLink\'.'
1519  . ' It has been migrated from TCA "' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1520  . '[\'wizards\'][\'' . $wizardName . '\']" to "' . $table
1521  . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'renderType\'] = \'inputLink\'"';
1522  }
1523  }
1524  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1525  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1526  }
1527  }
1528  }
1529  }
1530  }
1531  }
1532  }
1533  }
1534  }
1535 
1536  return ‪$tca;
1537  }
1538 
1545  protected function migrateEditWizardToFieldControl(array ‪$tca): array
1546  {
1547  foreach (‪$tca as $table => &$tableDefinition) {
1548  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1549  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1550  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
1551  || $fieldConfig['config']['type'] === 'select')
1552  ) {
1553  if (isset($fieldConfig['config']['wizards'])
1554  && is_array($fieldConfig['config']['wizards'])
1555  ) {
1556  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1557  if (isset($wizardConfig['type'])
1558  && $wizardConfig['type'] === 'popup'
1559  && isset($wizardConfig['module']['name'])
1560  && $wizardConfig['module']['name'] === 'wizard_edit'
1561  && !isset($fieldConfig['config']['fieldControl']['editPopup'])
1562  ) {
1563  $fieldConfig['config']['fieldControl']['editPopup']['disabled'] = false;
1564  if (isset($wizardConfig['title'])) {
1565  $fieldConfig['config']['fieldControl']['editPopup']['options']['title'] = $wizardConfig['title'];
1566  }
1567  if (isset($wizardConfig['JSopenParams'])) {
1568  $fieldConfig['config']['fieldControl']['editPopup']['options']['windowOpenParameters']
1569  = $wizardConfig['JSopenParams'];
1570  }
1571  unset($fieldConfig['config']['wizards'][$wizardName]);
1572  $this->messages[] = 'The edit wizard in TCA has been migrated to a \'fieldControl\' = \'editPopup\' element.'
1573  . ' It has been migrated from TCA "'
1574  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']" to "'
1575  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldControl\']=\'editPopup\'".';
1576  }
1577  }
1578  }
1579  if (empty($fieldConfig['config']['wizards'])) {
1580  unset($fieldConfig['config']['wizards']);
1581  }
1582  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1583  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1584  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1585  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1586  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1587  ) {
1588  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1589  if (isset($wizard['type'])
1590  && $wizard['type'] === 'popup'
1591  && isset($wizard['module']['name'])
1592  && $wizard['module']['name'] === 'wizard_edit'
1593  ) {
1594  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['editPopup']['disabled'] = false;
1595  if (isset($wizard['title'])) {
1596  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['editPopup']['options']['title']
1597  = $wizard['title'];
1598  }
1599  if (isset($wizard['JSopenParams'])) {
1600  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['editPopup']['options']['windowOpenParameters']
1601  = $wizard['JSopenParams'];
1602  }
1603  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1604  $this->messages[] = 'The edit wizard in columnsOverrides using \'type\' = \'popup\' has been migrated to a \'fieldControl\' = \'editPopup\' element.'
1605  . ' It has been migrated from TCA "'
1606  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1607  . '[\'wizards\'][\'' . $wizardName . '\']" , to "'
1608  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'fieldControl\']=\'editPopup\'".';
1609  }
1610  }
1611  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1612  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1613  }
1614  }
1615  }
1616  }
1617  }
1618  }
1619  }
1620  }
1621  }
1622 
1623  return ‪$tca;
1624  }
1625 
1632  protected function migrateAddWizardToFieldControl(array ‪$tca): array
1633  {
1634  foreach (‪$tca as $table => &$tableDefinition) {
1635  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1636  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1637  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
1638  || $fieldConfig['config']['type'] === 'select')
1639  ) {
1640  if (isset($fieldConfig['config']['wizards'])
1641  && is_array($fieldConfig['config']['wizards'])
1642  ) {
1643  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1644  if (isset($wizardConfig['type'])
1645  && $wizardConfig['type'] === 'script'
1646  && isset($wizardConfig['module']['name'])
1647  && $wizardConfig['module']['name'] === 'wizard_add'
1648  && !isset($fieldConfig['config']['fieldControl']['addRecord'])
1649  ) {
1650  $fieldConfig['config']['fieldControl']['addRecord']['disabled'] = false;
1651  if (isset($wizardConfig['title'])) {
1652  $fieldConfig['config']['fieldControl']['addRecord']['options']['title'] = $wizardConfig['title'];
1653  }
1654  if (isset($wizardConfig['params']['table'])) {
1655  $fieldConfig['config']['fieldControl']['addRecord']['options']['table']
1656  = $wizardConfig['params']['table'];
1657  }
1658  if (isset($wizardConfig['params']['pid'])) {
1659  $fieldConfig['config']['fieldControl']['addRecord']['options']['pid']
1660  = $wizardConfig['params']['pid'];
1661  }
1662  if (isset($wizardConfig['params']['setValue'])) {
1663  $fieldConfig['config']['fieldControl']['addRecord']['options']['setValue']
1664  = $wizardConfig['params']['setValue'];
1665  }
1666  unset($fieldConfig['config']['wizards'][$wizardName]);
1667  $this->messages[] = 'The add wizard in TCA has been migrated to a \'fieldControl\' = \'addRecord\' element.'
1668  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
1669  . ' It has been migrated from TCA "'
1670  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldControl\']=\'addRecord\'.';
1671  }
1672  }
1673  }
1674  if (empty($fieldConfig['config']['wizards'])) {
1675  unset($fieldConfig['config']['wizards']);
1676  }
1677  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1678  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1679  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1680  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1681  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1682  ) {
1683  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1684  if (isset($wizard['type'])
1685  && $wizard['type'] === 'script'
1686  && isset($wizard['module']['name'])
1687  && $wizard['module']['name'] === 'wizard_add'
1688  ) {
1689  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['addRecord']['disabled'] = false;
1690  if (isset($wizard['title'])) {
1691  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['addRecord']['options']['title']
1692  = $wizard['title'];
1693  }
1694  if (isset($wizard['params']['table'])) {
1695  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['addRecord']['options']['table']
1696  = $wizard['params']['table'];
1697  }
1698  if (isset($wizard['params']['pid'])) {
1699  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['addRecord']['options']['pid']
1700  = $wizard['params']['pid'];
1701  }
1702  if (isset($wizard['params']['setValue'])) {
1703  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['addRecord']['options']['setValue']
1704  = $wizard['params']['setValue'];
1705  }
1706  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1707  $this->messages[] = 'The add wizard in columnsOverrides using \'type\' = \'script\' has been migrated to a \'fieldControl\' = \'addRecord\' element.'
1708  . ' It has been migrated from TCA "'
1709  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1710  . '[\'wizards\'][\'' . $wizardName . '\']" to "'
1711  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'fieldControl\'=\'addRecord\'".';
1712  }
1713  }
1714  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1715  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1716  }
1717  }
1718  }
1719  }
1720  }
1721  }
1722  }
1723  }
1724  }
1725 
1726  return ‪$tca;
1727  }
1728 
1735  protected function migrateListWizardToFieldControl(array ‪$tca): array
1736  {
1737  foreach (‪$tca as $table => &$tableDefinition) {
1738  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1739  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1740  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
1741  || $fieldConfig['config']['type'] === 'select')
1742  ) {
1743  if (isset($fieldConfig['config']['wizards'])
1744  && is_array($fieldConfig['config']['wizards'])
1745  ) {
1746  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1747  if (isset($wizardConfig['type'])
1748  && $wizardConfig['type'] === 'script'
1749  && isset($wizardConfig['module']['name'])
1750  && $wizardConfig['module']['name'] === 'wizard_list'
1751  && !isset($fieldConfig['config']['fieldControl']['listModule'])
1752  ) {
1753  $fieldConfig['config']['fieldControl']['listModule']['disabled'] = false;
1754  if (isset($wizardConfig['title'])) {
1755  $fieldConfig['config']['fieldControl']['listModule']['options']['title'] = $wizardConfig['title'];
1756  }
1757  if (isset($wizardConfig['params']['table'])) {
1758  $fieldConfig['config']['fieldControl']['listModule']['options']['table']
1759  = $wizardConfig['params']['table'];
1760  }
1761  if (isset($wizardConfig['params']['pid'])) {
1762  $fieldConfig['config']['fieldControl']['listModule']['options']['pid']
1763  = $wizardConfig['params']['pid'];
1764  }
1765  unset($fieldConfig['config']['wizards'][$wizardName]);
1766  $this->messages[] = 'The list wizard in TCA has been migrated to a \'fieldControl\' = \'listModule\' element.'
1767  . ' It has been migrated from TCA "'
1768  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
1769  . '" to "'
1770  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldControl\'=\'listModule\'".';
1771  }
1772  }
1773  }
1774  if (empty($fieldConfig['config']['wizards'])) {
1775  unset($fieldConfig['config']['wizards']);
1776  }
1777  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1778  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1779  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1780  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1781  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1782  ) {
1783  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1784  if (isset($wizard['type'])
1785  && $wizard['type'] === 'script'
1786  && isset($wizard['module']['name'])
1787  && $wizard['module']['name'] === 'wizard_list'
1788  ) {
1789  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['listModule']['disabled'] = false;
1790  if (isset($wizard['title'])) {
1791  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['listModule']['options']['title']
1792  = $wizard['title'];
1793  }
1794  if (isset($wizard['params']['table'])) {
1795  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['listModule']['options']['table']
1796  = $wizard['params']['table'];
1797  }
1798  if (isset($wizard['params']['pid'])) {
1799  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['listModule']['options']['pid']
1800  = $wizard['params']['pid'];
1801  }
1802  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1803  $this->messages[] = 'The list wizard in columnsOverrides using \'type\' = \'script\' has been migrated to a \'fieldControl\' = \'listModule\' element.'
1804  . ' It has been migrated from TCA "'
1805  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1806  . '[\'wizards\'][\'' . $wizardName . '\']" to "'
1807  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'fieldControl\'=\'listModule\'".';
1808  }
1809  }
1810  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
1811  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
1812  }
1813  }
1814  }
1815  }
1816  }
1817  }
1818  }
1819  }
1820  }
1821 
1822  return ‪$tca;
1823  }
1824 
1832  protected function migrateLastPiecesOfDefaultExtras(array ‪$tca): array
1833  {
1834  foreach (‪$tca as $table => &$tableDefinition) {
1835  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1836  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1837  if (isset($fieldConfig['defaultExtras'])) {
1838  $defaultExtrasArray = GeneralUtility::trimExplode(':', $fieldConfig['defaultExtras'], true);
1839  foreach ($defaultExtrasArray as $defaultExtrasSetting) {
1840  if ($defaultExtrasSetting === 'rte_only') {
1841  $this->messages[] = 'The defaultExtras setting \'rte_only\' in TCA table '
1842  . $table . '[\'columns\'][\'' . $fieldName . '\'] has been dropped, the setting'
1843  . ' is no longer supported';
1844  continue;
1845  }
1846  if ($defaultExtrasSetting === 'nowrap') {
1847  $fieldConfig['config']['wrap'] = 'off';
1848  $this->messages[] = 'The defaultExtras setting \'nowrap\' in TCA table '
1849  . $table . '[\'columns\'][\'' . $fieldName . '\'] has been migrated to TCA table '
1850  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wrap\'] = \'off\'';
1851  } elseif ($defaultExtrasSetting === 'enable-tab') {
1852  $fieldConfig['config']['enableTabulator'] = true;
1853  $this->messages[] = 'The defaultExtras setting \'enable-tab\' in TCA table '
1854  . $table . '[\'columns\'][\'' . $fieldName . '\'] has been migrated to TCA table '
1855  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'enableTabulator\'] = true';
1856  } elseif ($defaultExtrasSetting === 'fixed-font') {
1857  $fieldConfig['config']['fixedFont'] = true;
1858  $this->messages[] = 'The defaultExtras setting \'fixed-font\' in TCA table '
1859  . $table . '[\'columns\'][\'' . $fieldName . '\'] has been migrated to TCA table '
1860  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fixedFont\'] = true';
1861  } else {
1862  $this->messages[] = 'The defaultExtras setting \'' . $defaultExtrasSetting . '\' in TCA table '
1863  . $table . '[\'columns\'][\'' . $fieldName . '\'] is unknown and has been dropped.';
1864  }
1865  }
1866  unset($fieldConfig['defaultExtras']);
1867  }
1868  }
1869  }
1870  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1871  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1872  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1873  foreach ($typeArray['columnsOverrides'] as $fieldName => &$overrideConfig) {
1874  if (!isset($overrideConfig['defaultExtras'])) {
1875  continue;
1876  }
1877  $defaultExtrasArray = GeneralUtility::trimExplode(':', $overrideConfig['defaultExtras'], true);
1878  foreach ($defaultExtrasArray as $defaultExtrasSetting) {
1879  if ($defaultExtrasSetting === 'rte_only') {
1880  $this->messages[] = 'The defaultExtras setting \'rte_only\' in TCA table '
1881  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']'
1882  . ' has been dropped, the setting is no longer supported';
1883  continue;
1884  }
1885  if ($defaultExtrasSetting === 'nowrap') {
1886  $overrideConfig['config']['wrap'] = 'off';
1887  $this->messages[] = 'The defaultExtras setting \'nowrap\' in TCA table '
1888  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']'
1889  . ' has been migrated to TCA table '
1890  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'wrap\'] = \'off\'';
1891  } elseif ($defaultExtrasSetting === 'enable-tab') {
1892  $overrideConfig['config']['enableTabulator'] = true;
1893  $this->messages[] = 'The defaultExtras setting \'enable-tab\' in TCA table '
1894  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']'
1895  . ' has been migrated to TCA table '
1896  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'enableTabulator\'] = true';
1897  } elseif ($defaultExtrasSetting === 'fixed-font') {
1898  $overrideConfig['config']['fixedFont'] = true;
1899  $this->messages[] = 'The defaultExtras setting \'fixed-font\' in TCA table '
1900  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']'
1901  . ' has been migrated to TCA table '
1902  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'fixedFont\'] = true';
1903  } else {
1904  $this->messages[] = 'The defaultExtras setting \'' . $defaultExtrasSetting . '\' in TCA table '
1905  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']'
1906  . ' is unknown and has been dropped.';
1907  }
1908  }
1909  unset($overrideConfig['defaultExtras']);
1910  }
1911  }
1912  }
1913  }
1914  }
1915 
1916  return $tca;
1917  }
1918 
1925  protected function migrateTableWizardToRenderType(array $tca): array
1926  {
1927  foreach ($tca as $table => &$tableDefinition) {
1928  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
1929  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
1930  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'text') {
1931  if (isset($fieldConfig['config']['wizards'])
1932  && is_array($fieldConfig['config']['wizards'])
1933  ) {
1934  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
1935  if (isset($wizardConfig['type'])
1936  && $wizardConfig['type'] === 'script'
1937  && isset($wizardConfig['module']['name'])
1938  && $wizardConfig['module']['name'] === 'wizard_table'
1939  && !isset($fieldConfig['config']['fieldControl']['tableWizard'])
1940  && !isset($fieldConfig['config']['renderType'])
1941  ) {
1942  $fieldConfig['config']['renderType'] = 'textTable';
1943  if (isset($wizardConfig['title'])) {
1944  $fieldConfig['config']['fieldControl']['tableWizard']['options']['title'] = $wizardConfig['title'];
1945  }
1946  if (isset($wizardConfig['params']['xmlOutput']) && (int)$wizardConfig['params']['xmlOutput'] !== 0) {
1947  $fieldConfig['config']['fieldControl']['tableWizard']['options']['xmlOutput']
1948  = (int)$wizardConfig['params']['xmlOutput'];
1949  }
1950  if (isset($wizardConfig['params']['numNewRows'])) {
1951  $fieldConfig['config']['fieldControl']['tableWizard']['options']['numNewRows']
1952  = $wizardConfig['params']['numNewRows'];
1953  }
1954  unset($fieldConfig['config']['wizards'][$wizardName]);
1955  $this->messages[] = 'The table wizard in TCA has been migrated to a \'renderType\' = \'textTable\'.'
1956  . ' It has been migrated from TCA "'
1957  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
1958  . '" to "'
1959  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'renderType\'] = \'textTable\'".';
1960  }
1961  }
1962  }
1963  if (empty($fieldConfig['config']['wizards'])) {
1964  unset($fieldConfig['config']['wizards']);
1965  }
1966  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
1967  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
1968  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
1969  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1970  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
1971  ) {
1972  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
1973  if (isset($wizard['type'])
1974  && $wizard['type'] === 'script'
1975  && isset($wizard['module']['name'])
1976  && $wizard['module']['name'] === 'wizard_table'
1977  && !isset($typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['tableWizard'])
1978  && !isset($typeArray['columnsOverrides'][$fieldName]['config']['renderType'])
1979  ) {
1980  $typeArray['columnsOverrides'][$fieldName]['config']['renderType'] = 'textTable';
1981  if (isset($wizard['title'])) {
1982  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['tableWizard']['options']['title']
1983  = $wizard['title'];
1984  }
1985  if (isset($wizard['params']['xmlOutput']) && (int)$wizard['params']['xmlOutput'] !== 0) {
1986  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['tableWizard']['options']['xmlOutput']
1987  = (int)$wizard['params']['xmlOutput'];
1988  }
1989  if (isset($wizard['params']['numNewRows'])) {
1990  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['tableWizard']['options']['numNewRows']
1991  = $wizard['params']['numNewRows'];
1992  }
1993  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
1994  $this->messages[] = 'The table wizard in columnsOverrides using \'type\' = \'script\' has been migrated to a \'renderType\' = \'textTable\'.'
1995  . ' It has been migrated from TCA "'
1996  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
1997  . '[\'wizards\'][\'' . $wizardName . '\']" to "'
1998  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'renderType\'] = \'textTable\'".';
1999  }
2000  }
2001  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
2002  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
2003  }
2004  }
2005  }
2006  }
2007  }
2008  }
2009  }
2010  }
2011  }
2012 
2013  return ‪$tca;
2014  }
2015 
2022  protected function migrateFullScreenRichtextToFieldControl(array ‪$tca): array
2023  {
2024  foreach (‪$tca as $table => &$tableDefinition) {
2025  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2026  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2027  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'text') {
2028  if (isset($fieldConfig['config']['wizards'])
2029  && is_array($fieldConfig['config']['wizards'])
2030  ) {
2031  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
2032  if (isset($wizardConfig['type'])
2033  && $wizardConfig['type'] === 'script'
2034  && isset($wizardConfig['module']['name'])
2035  && $wizardConfig['module']['name'] === 'wizard_rte'
2036  && !isset($fieldConfig['config']['fieldControl']['fullScreenRichtext'])
2037  && isset($fieldConfig['config']['enableRichtext'])
2038  && (bool)$fieldConfig['config']['enableRichtext'] === true
2039  ) {
2040  // Field is configured for richtext, so enable the full screen wizard
2041  $fieldConfig['config']['fieldControl']['fullScreenRichtext']['disabled'] = false;
2042  if (isset($wizardConfig['title'])) {
2043  $fieldConfig['config']['fieldControl']['fullScreenRichtext']['options']['title'] = $wizardConfig['title'];
2044  }
2045  unset($fieldConfig['config']['wizards'][$wizardName]);
2046  $this->messages[] = 'The RTE fullscreen wizard in TCA has been migrated to a \'fieldControl\' = \'fullScreenRichtext\'.'
2047  . ' It has been migrated from TCA "'
2048  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
2049  . '" to "'
2050  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldControl\']=\'fullScreenRichtext\'".';
2051  } elseif (isset($wizardConfig['type'])
2052  && $wizardConfig['type'] === 'script'
2053  && isset($wizardConfig['module']['name'])
2054  && $wizardConfig['module']['name'] === 'wizard_rte'
2055  && !isset($fieldConfig['config']['fieldControl']['fullScreenRichtext'])
2056  && (
2057  !isset($fieldConfig['config']['enableRichtext'])
2058  || isset($fieldConfig['config']['enableRichtext']) && (bool)$fieldConfig['config']['enableRichtext'] === false
2059  )
2060  ) {
2061  // Wizard is given, but field is not configured for richtext
2062  // Find types that enableRichtext and enable full screen for those types
2063  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
2064  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
2065  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
2066  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['enableRichtext'])
2067  && (bool)$typeArray['columnsOverrides'][$fieldName]['config']['enableRichtext'] === true
2068  ) {
2069  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['fullScreenRichtext']['disabled'] = false;
2070  if (isset($wizardConfig['title'])) {
2071  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['fullScreenRichtext']['options']['title']
2072  = $wizardConfig['title'];
2073  }
2074  $this->messages[] = 'The RTE fullscreen wizard in TCA has been migrated to a \'fieldControl\' = \'fullScreenRichtext\'.'
2075  . ' It has been migrated from TCA "'
2076  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
2077  . '" to "'
2078  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'fieldControl\']=\'fullScreenRichtext\'';
2079  }
2080  }
2081  }
2082  }
2083  unset($fieldConfig['config']['wizards'][$wizardName]);
2084  }
2085  }
2086  }
2087  if (empty($fieldConfig['config']['wizards'])) {
2088  unset($fieldConfig['config']['wizards']);
2089  }
2090  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
2091  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
2092  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
2093  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
2094  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
2095  ) {
2096  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
2097  if (isset($wizard['type'])
2098  && $wizard['type'] === 'script'
2099  && isset($wizard['module']['name'])
2100  && $wizard['module']['name'] === 'wizard_rte'
2101  && !isset($typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['fullScreenRichtext'])
2102  ) {
2103  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['fullScreenRichtext']['disabled'] = false;
2104  if (isset($wizard['title'])) {
2105  $typeArray['columnsOverrides'][$fieldName]['config']['fieldControl']['fullScreenRichtext']['options']['title']
2106  = $wizard['title'];
2107  }
2108  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
2109  $this->messages[] = 'The RTE fullscreen wizard in columnsOverrides using \'type\' = \'script\' has been migrated to a \'fieldControl\' = \'fullScreenRichtext\'.'
2110  . ' It has been migrated from TCA "'
2111  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
2112  . '[\'wizards\'][\'' . $wizardName . '\']" to "'
2113  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'fieldControl\']=\'fullScreenRichtext\'".';
2114  }
2115  }
2116  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
2117  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
2118  }
2119  }
2120  }
2121  }
2122  }
2123  }
2124  }
2125  }
2126  }
2127 
2128  return ‪$tca;
2129  }
2130 
2137  protected function migrateSuggestWizardTypeGroup(array ‪$tca): array
2138  {
2139  foreach (‪$tca as $table => &$tableDefinition) {
2140  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2141  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2142  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'group'
2143  && isset($fieldConfig['config']['internal_type'])
2144  && $fieldConfig['config']['internal_type'] === 'db')
2145  ) {
2146  if (isset($fieldConfig['config']['hideSuggest'])) {
2147  continue;
2148  }
2149  if (isset($fieldConfig['config']['wizards']) && is_array($fieldConfig['config']['wizards'])) {
2150  foreach ($fieldConfig['config']['wizards'] as $wizardName => $wizardConfig) {
2151  if (isset($wizardConfig['type']) && $wizardConfig['type'] === 'suggest') {
2152  unset($wizardConfig['type']);
2153  if (!empty($wizardConfig)) {
2154  $fieldConfig['config']['suggestOptions'] = $wizardConfig;
2155  $this->messages[] = 'The suggest wizard options in TCA '
2156  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
2157  . ' have been migrated to '
2158  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'suggestOptions\'].';
2159  } else {
2160  $this->messages[] = 'The suggest wizard in TCA '
2161  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'wizards\'][\'' . $wizardName . '\']'
2162  . ' is enabled by default and has been removed.';
2163  }
2164  unset($fieldConfig['config']['wizards'][$wizardName]);
2165  }
2166  }
2167  }
2168  if (empty($fieldConfig['config']['wizards'])) {
2169  unset($fieldConfig['config']['wizards']);
2170  }
2171  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
2172  foreach ($tableDefinition['types'] as $typeName => &$typeArray) {
2173  if (isset($typeArray['columnsOverrides']) && is_array($typeArray['columnsOverrides'])) {
2174  if (isset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
2175  && is_array($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])
2176  ) {
2177  foreach ($typeArray['columnsOverrides'][$fieldName]['config']['wizards'] as $wizardName => $wizard) {
2178  if (isset($wizard['type']) && $wizard['type'] === 'suggest'
2179  ) {
2180  unset($wizard['type']);
2181  $fieldConfig['config']['hideSuggest'] = true;
2182  $typeArray['columnsOverrides'][$fieldName]['config']['hideSuggest'] = false;
2183  if (!empty($wizard)) {
2184  $typeArray['columnsOverrides'][$fieldName]['config']['suggestOptions'] = $wizard;
2185  $this->messages[] = 'The suggest wizard options in columnsOverrides have been migrated'
2186  . ' from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
2187  . '[\'wizards\'][\'' . $wizardName . '\'] to \'suggestOptions\' in '
2188  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']';
2189  } else {
2190  $this->messages[] = 'The suggest wizard in columnsOverrides has been migrated'
2191  . ' from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\']'
2192  . '[\'wizards\'][\'' . $wizardName . '\'] to \'hideSuggest\' => false in '
2193  . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'config\'][\'hideSuggest\']';
2194  }
2195  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards'][$wizardName]);
2196  }
2197  }
2198  if (empty($typeArray['columnsOverrides'][$fieldName]['config']['wizards'])) {
2199  unset($typeArray['columnsOverrides'][$fieldName]['config']['wizards']);
2200  }
2201  }
2202  }
2203  }
2204  }
2205  }
2206  }
2207  }
2208  }
2209 
2210  return ‪$tca;
2211  }
2212 
2219  protected function migrateOptionsOfTypeGroup(array ‪$tca): array
2220  {
2221  foreach (‪$tca as $table => &$tableDefinition) {
2222  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2223  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2224  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'group') {
2225  if (isset($fieldConfig['config']['selectedListStyle'])) {
2226  unset($fieldConfig['config']['selectedListStyle']);
2227  $this->messages[] = 'The \'type\' = \'group\' option \'selectedListStyle\' is obsolete and has been dropped'
2228  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
2229  }
2230  if (isset($fieldConfig['config']['show_thumbs'])) {
2231  if ((bool)$fieldConfig['config']['show_thumbs'] === false && $fieldConfig['config']['internal_type'] === 'db') {
2232  $fieldConfig['config']['fieldWizard']['recordsOverview']['disabled'] = true;
2233  $this->messages[] = 'The \'type\' = \'group\' option \'show_thumbs\' = false is obsolete'
2234  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2235  . ' and has been migrated to'
2236  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldWizard\'][\'recordsOverview\'][\'disabled\'] = true';
2237  } elseif ((bool)$fieldConfig['config']['show_thumbs'] === false && $fieldConfig['config']['internal_type'] === 'file') {
2238  $fieldConfig['config']['fieldWizard']['fileThumbnails']['disabled'] = true;
2239  $this->messages[] = 'The \'type\' = \'group\' option \'show_thumbs\' = false is obsolete'
2240  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2241  . ' and has been migrated to'
2242  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldWizard\'][\'fileThumbnails\'][\'disabled\'] = true';
2243  } else {
2244  $this->messages[] = 'The \'type\' = \'group\' option \'show_thumbs\' is obsolete and has been dropped'
2245  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
2246  }
2247  unset($fieldConfig['config']['show_thumbs']);
2248  }
2249  if (isset($fieldConfig['config']['disable_controls']) && is_string($fieldConfig['config']['disable_controls'])) {
2250  $controls = GeneralUtility::trimExplode(',', $fieldConfig['config']['disable_controls'], true);
2251  foreach ($controls as $control) {
2252  if ($control === 'browser') {
2253  $fieldConfig['config']['fieldControl']['elementBrowser']['disabled'] = true;
2254  $this->messages[] = 'The \'type\' = \'group\' option \'disable_controls\' = \'browser\''
2255  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2256  . ' and has been migrated to'
2257  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldControl\'][\'elementBrowser\'][\'disabled\'] = true';
2258  } elseif ($control === 'delete') {
2259  $this->messages[] = 'The \'type\' = \'group\' option \'disable_controls\' = \'delete\''
2260  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2261  . ' and has been migrated to'
2262  . $table . '[\'columns\'][\' . $fieldName . \'][\'config\'][\'hideDeleteIcon\'] = true';
2263  $fieldConfig['config']['hideDeleteIcon'] = true;
2264  } elseif ($control === 'allowedTables') {
2265  $fieldConfig['config']['fieldWizard']['tableList']['disabled'] = true;
2266  $this->messages[] = 'The \'type\' = \'group\' option \'disable_controls\' = \'allowedTables\''
2267  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2268  . ' and has been migrated to'
2269  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldWizard\'][\'tableList\'][\'disabled\'] = true';
2270  } elseif ($control === 'upload') {
2271  $fieldConfig['config']['fieldWizard']['fileUpload']['disabled'] = true;
2272  $this->messages[] = 'The \'type\' = \'group\' option \'disable_controls\' = \'upload\''
2273  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2274  . ' and has been migrated to'
2275  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'fieldWizard\'][\'fileUpload\'][\'disabled\'] = true';
2276  }
2277  }
2278  unset($fieldConfig['config']['disable_controls']);
2279  }
2280  }
2281  }
2282  }
2283  }
2284 
2285  return ‪$tca;
2286  }
2287 
2294  protected function migrateSelectShowIconTable(array ‪$tca): array
2295  {
2296  foreach (‪$tca as $table => &$tableDefinition) {
2297  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2298  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2299  if (isset($fieldConfig['config']['type']) && ($fieldConfig['config']['type'] === 'select'
2300  && isset($fieldConfig['config']['renderType'])
2301  && $fieldConfig['config']['renderType'] === 'selectSingle')
2302  ) {
2303  if (isset($fieldConfig['config']['showIconTable'])) {
2304  if ((bool)$fieldConfig['config']['showIconTable'] === true) {
2305  $fieldConfig['config']['fieldWizard']['selectIcons']['disabled'] = false;
2306  $this->messages[] = 'The \'type\' = \'select\' option \'showIconTable\' = true is obsolete'
2307  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2308  . ' and has been migrated to'
2309  . ' [\'config\'][\'fieldWizard\'][\'selectIcons\'][\'disabled\'] = false';
2310  } else {
2311  $this->messages[] = 'The \'type\' = \'group\' option \'showIconTable\' = false is obsolete'
2312  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2313  . ' and has been removed.';
2314  }
2315  unset($fieldConfig['config']['showIconTable']);
2316  }
2317  if (isset($fieldConfig['config']['selicon_cols'])) {
2318  unset($fieldConfig['config']['selicon_cols']);
2319  $this->messages[] = 'The \'type\' = \'group\' option \'selicon_cols\' = false is obsolete'
2320  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']'
2321  . ' and has been removed.';
2322  }
2323  }
2324  }
2325  }
2326  }
2327 
2328  return ‪$tca;
2329  }
2330 
2337  protected function migrateImageManipulationConfig(array ‪$tca): array
2338  {
2339  foreach (‪$tca as $table => &$tableDefinition) {
2340  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2341  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2342  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] === 'imageManipulation') {
2343  if (isset($fieldConfig['config']['enableZoom'])) {
2344  unset($fieldConfig['config']['enableZoom']);
2345  $this->messages[] = sprintf(
2346  'The config option "enableZoom" has been removed from TCA type "imageManipulation" in table "%s" and field "%s"',
2347  $table,
2348  $fieldName
2349  );
2350  }
2351  if (isset($fieldConfig['config']['ratios'])) {
2352  $legacyRatios = $fieldConfig['config']['ratios'];
2353  unset($fieldConfig['config']['ratios']);
2354  if (isset($fieldConfig['config']['cropVariants'])) {
2355  $this->messages[] = sprintf(
2356  'The config option "ratios" has been deprecated and cannot be used together with the option "cropVariants" in table "%s" and field "%s"',
2357  $table,
2358  $fieldName
2359  );
2360  continue;
2361  }
2362  $fieldConfig['config']['cropVariants']['default'] = [
2363  'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.crop_variant.default',
2364  'allowedAspectRatios' => [],
2365  'cropArea' => [
2366  'x' => 0.0,
2367  'y' => 0.0,
2368  'width' => 1.0,
2369  'height' => 1.0,
2370  ],
2371  ];
2372  foreach ($legacyRatios as $ratio => $ratioLabel) {
2373  $ratio = (float)$ratio;
2374  $ratioId = number_format($ratio, 2);
2375  $fieldConfig['config']['cropVariants']['default']['allowedAspectRatios'][$ratioId] = [
2376  'title' => $ratioLabel,
2377  'value' => $ratio,
2378  ];
2379  }
2380  $this->messages[] = sprintf(
2381  'Migrated config option "ratios" of type "imageManipulation" to option "cropVariants" in table "%s" and field "%s"',
2382  $table,
2383  $fieldName
2384  );
2385  }
2386  }
2387  }
2388  }
2389  }
2390 
2391  return ‪$tca;
2392  }
2393 
2400  protected function migrateinputDateTimeMax(array ‪$tca): array
2401  {
2402  foreach (‪$tca as $table => &$tableDefinition) {
2403  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2404  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2405  if (isset($fieldConfig['config']['renderType']) && $fieldConfig['config']['renderType'] === 'inputDateTime') {
2406  if (isset($fieldConfig['config']['max'])) {
2407  unset($fieldConfig['config']['max']);
2408  $this->messages[] = 'The config option \'max\' has been removed from the TCA for renderType=\'inputDateTime\' in ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'max\']';
2409  }
2410  }
2411  }
2412  }
2413  }
2414 
2415  return ‪$tca;
2416  }
2417 
2425  protected function migrateInlineOverrideChildTca(array ‪$tca): array
2426  {
2427  foreach (‪$tca as $table => &$tableDefinition) {
2428  if (isset($tableDefinition['types']) && is_array($tableDefinition['types'])) {
2429  foreach ($tableDefinition['types'] as $typeName => &$typeConfig) {
2430  if (!isset($typeConfig['columnsOverrides']) || !is_array($typeConfig['columnsOverrides'])) {
2431  continue;
2432  }
2433  foreach ($typeConfig['columnsOverrides'] as $fieldName => &$fieldConfig) {
2434  if (isset($fieldConfig['config']['overrideChildTca'])
2435  || (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] !== 'inline')
2436  || (!isset($fieldConfig['config']['type']) && (empty(‪$tca[$table]['columns'][$fieldName]['config']['type']) || ‪$tca[$table]['columns'][$fieldName]['config']['type'] !== 'inline'))
2437  ) {
2438  // The new config is either set intentionally for compatibility
2439  // or accidentally. In any case we keep the new config and skip the migration.
2440  continue;
2441  }
2442  if (isset($fieldConfig['config']['foreign_types']) && is_array($fieldConfig['config']['foreign_types'])) {
2443  $fieldConfig['config']['overrideChildTca']['types'] = $fieldConfig['config']['foreign_types'];
2444  unset($fieldConfig['config']['foreign_types']);
2445  $this->messages[] = 'The \'foreign_types\' property from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'] has been migrated to ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'types\']';
2446  }
2447  if (isset($fieldConfig['config']['foreign_selector_fieldTcaOverride']) && is_array($fieldConfig['config']['foreign_selector_fieldTcaOverride'])) {
2448  $foreignSelectorFieldName = '';
2449  if (isset($fieldConfig['config']['foreign_selector']) && is_string($fieldConfig['config']['foreign_selector'])) {
2450  $foreignSelectorFieldName = $fieldConfig['config']['foreign_selector'];
2451  } elseif (isset(‪$tca[$table]['columns'][$fieldName]['config']['foreign_selector']) && is_string(‪$tca[$table]['columns'][$fieldName]['config']['foreign_selector'])) {
2452  $foreignSelectorFieldName = ‪$tca[$table]['columns'][$fieldName]['config']['foreign_selector'];
2453  }
2454  if ($foreignSelectorFieldName) {
2455  $fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName] = $fieldConfig['config']['foreign_selector_fieldTcaOverride'];
2456  unset($fieldConfig['config']['foreign_selector_fieldTcaOverride']);
2457  $this->messages[] = 'The \'foreign_selector_fieldTcaOverride\' property from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'] and has been migrated to ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'columns\'][\'' . $foreignSelectorFieldName . '\']';
2458  }
2459  }
2460  if (isset($fieldConfig['config']['foreign_record_defaults']) && is_array($fieldConfig['config']['foreign_record_defaults'])) {
2461  foreach ($fieldConfig['config']['foreign_record_defaults'] as $childFieldName => $defaultValue) {
2462  $fieldConfig['config']['overrideChildTca']['columns'][$childFieldName]['config']['default'] = $defaultValue;
2463  $this->messages[] = 'The \'foreign_record_defaults\' property from TCA ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'' . $childFieldName . '\'] and has been migrated to ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'columns\'][\'' . $childFieldName . '\'][\'config\'][\'default\']';
2464  }
2465  unset($fieldConfig['config']['foreign_record_defaults']);
2466  }
2467  }
2468  unset($fieldConfig);
2469  }
2470  unset($typeConfig);
2471  }
2472  if (isset($tableDefinition['columns']) && is_array($tableDefinition['columns'])) {
2473  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2474  if (isset($fieldConfig['config']['type']) && $fieldConfig['config']['type'] !== 'inline') {
2475  continue;
2476  }
2477  if (isset($fieldConfig['config']['foreign_types']) && is_array($fieldConfig['config']['foreign_types'])) {
2478  if (isset($fieldConfig['config']['overrideChildTca']['types'])
2479  && is_array($fieldConfig['config']['overrideChildTca']['types'])
2480  ) {
2481  $fieldConfig['config']['overrideChildTca']['types'] = array_replace_recursive(
2482  $fieldConfig['config']['foreign_types'],
2483  $fieldConfig['config']['overrideChildTca']['types']
2484  );
2485  } else {
2486  $fieldConfig['config']['overrideChildTca']['types'] = $fieldConfig['config']['foreign_types'];
2487  }
2488  unset($fieldConfig['config']['foreign_types']);
2489  $this->messages[] = 'The \'foreign_types\' property from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'] and has been migrated to ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'types\']';
2490  }
2491  if (isset($fieldConfig['config']['foreign_selector'], $fieldConfig['config']['foreign_selector_fieldTcaOverride']) && is_string($fieldConfig['config']['foreign_selector']) && is_array($fieldConfig['config']['foreign_selector_fieldTcaOverride'])) {
2492  $foreignSelectorFieldName = $fieldConfig['config']['foreign_selector'];
2493  if (isset($fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName])
2494  && is_array($fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName])
2495  ) {
2496  $fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName] = array_replace_recursive(
2497  $fieldConfig['config']['foreign_selector_fieldTcaOverride'],
2498  $fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName]
2499  );
2500  } else {
2501  $fieldConfig['config']['overrideChildTca']['columns'][$foreignSelectorFieldName] = $fieldConfig['config']['foreign_selector_fieldTcaOverride'];
2502  }
2503  unset($fieldConfig['config']['foreign_selector_fieldTcaOverride']);
2504  $this->messages[] = 'The \'foreign_selector_fieldTcaOverride\' property from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'] and has been migrated to ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'columns\'][\'' . $foreignSelectorFieldName . '\']';
2505  }
2506  if (isset($fieldConfig['config']['foreign_record_defaults']) && is_array($fieldConfig['config']['foreign_record_defaults'])) {
2507  foreach ($fieldConfig['config']['foreign_record_defaults'] as $childFieldName => $defaultValue) {
2508  if (!isset($fieldConfig['config']['overrideChildTca']['columns'][$childFieldName]['config']['default'])) {
2509  $fieldConfig['config']['overrideChildTca']['columns'][$childFieldName]['config']['default'] = $defaultValue;
2510  $this->messages[] = 'The \'foreign_record_defaults\' property from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'' . $childFieldName . '\'] and has been migrated to ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'overrideChildTca\'][\'columns\'][\'' . $childFieldName . '\'][\'config\'][\'default\']';
2511  }
2512  }
2513  unset($fieldConfig['config']['foreign_record_defaults']);
2514  }
2515  }
2516  unset($fieldConfig);
2517  }
2518  }
2519 
2520  return ‪$tca;
2521  }
2522 
2530  protected function migrateLocalizeChildrenAtParentLocalization(array ‪$tca): array
2531  {
2532  foreach (‪$tca as $table => &$tableDefinition) {
2533  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
2534  continue;
2535  }
2536  foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
2537  if (($fieldConfig['config']['type'] ?? null) !== 'inline') {
2538  continue;
2539  }
2540 
2541  $localizeChildrenAtParentLocalization = ($fieldConfig['config']['behaviour']['localizeChildrenAtParentLocalization'] ?? null);
2542  if ($localizeChildrenAtParentLocalization === null) {
2543  continue;
2544  }
2545 
2546  if ($localizeChildrenAtParentLocalization) {
2547  $this->messages[] = 'The TCA setting \'localizeChildrenAtParentLocalization\' is deprecated '
2548  . ' and should be removed from TCA for ' . $table . '[\'columns\']'
2549  . '[\'' . $fieldName . '\'][\'config\'][\'behaviour\'][\'localizeChildrenAtParentLocalization\']';
2550  } else {
2551  $this->messages[] = 'The TCA setting \'localizeChildrenAtParentLocalization\' is deprecated '
2552  . ', as this functionality is always enabled. The option should be removed from TCA for '
2553  . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'][\'behaviour\']'
2554  . '[\'localizeChildrenAtParentLocalization\']';
2555  }
2556  unset($fieldConfig['config']['behaviour']['localizeChildrenAtParentLocalization']);
2557  }
2558  }
2559  return ‪$tca;
2560  }
2561 
2568  protected function migratePagesLanguageOverlayRemoval(array ‪$tca)
2569  {
2570  if (isset(‪$tca['pages_language_overlay'])) {
2571  // If the feature is not enabled, a deprecation log entry is thrown
2572  if (!GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('unifiedPageTranslationHandling')) {
2573  $this->messages[] = 'The TCA table \'pages_language_overlay\' is'
2574  . ' not used anymore and has been removed automatically in'
2575  . ' order to avoid negative side-effects.';
2576  }
2577  unset(‪$tca['pages_language_overlay']);
2578  }
2579  return ‪$tca;
2580  }
2581 
2591  protected function deprecateTypeGroupInternalTypeFile(array ‪$tca): array
2592  {
2593  foreach (‪$tca as $table => $tableDefinition) {
2594  if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
2595  continue;
2596  }
2597  foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) {
2598  if (isset($fieldConfig['config']['type'], $fieldConfig['config']['internal_type'])
2599  && $fieldConfig['config']['type'] === 'group'
2600  && ($fieldConfig['config']['internal_type'] === 'file' || $fieldConfig['config']['internal_type'] === 'file_reference')
2601  ) {
2602  $this->messages[] = 'The \'internal_type\' = \'' . $fieldConfig['config']['internal_type'] . '\' property value'
2603  . ' from TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\'] is deprecated. It will continue'
2604  . ' to work is TYPO3 v9, but the functionality will be removed in TYPO3 v10.0. Switch to inline FAL instead.';
2605  }
2606  }
2607  }
2608  return ‪$tca;
2609  }
2610 
2623  protected function sanitizeControlSectionIntegrity(array ‪$tca): array
2624  {
2625  $controlSectionNames = [
2626  'origUid',
2627  'languageField',
2628  'transOrigPointerField',
2629  'translationSource'
2630  ];
2631  foreach (‪$tca as $tableName => &$configuration) {
2632  foreach ($controlSectionNames as $controlSectionName) {
2633  $columnName = $configuration['ctrl'][$controlSectionName] ?? null;
2634  if (empty($columnName) || !empty($configuration['columns'][$columnName])) {
2635  continue;
2636  }
2637  $configuration['columns'][$columnName] = [
2638  'config' => [
2639  'type' => 'passthrough',
2640  'default' => 0,
2641  ],
2642  ];
2643  }
2644  }
2645  return ‪$tca;
2646  }
2647 }
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateElementBrowserWizardToLinkHandler
‪array migrateElementBrowserWizardToLinkHandler(array $tca)
Definition: TcaMigration.php:713
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateL10nModeDefinitions
‪array migrateL10nModeDefinitions(array $tca)
Definition: TcaMigration.php:970
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateOptionsOfTypeGroup
‪array migrateOptionsOfTypeGroup(array $tca)
Definition: TcaMigration.php:2218
‪TYPO3\CMS\Core\Migrations\TcaMigration
Definition: TcaMigration.php:27
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrate
‪array migrate(array $tca)
Definition: TcaMigration.php:47
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateRequestUpdate
‪array migrateRequestUpdate(array $tca)
Definition: TcaMigration.php:1094
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSpecialConfigurationAndRemoveShowItemStylePointerConfig
‪array migrateSpecialConfigurationAndRemoveShowItemStylePointerConfig(array $tca)
Definition: TcaMigration.php:217
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSliderWizardToSliderConfiguration
‪array migrateSliderWizardToSliderConfiguration(array $tca)
Definition: TcaMigration.php:1372
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSelectFieldRenderType
‪array migrateSelectFieldRenderType(array $tca)
Definition: TcaMigration.php:608
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateColumnsConfig
‪array migrateColumnsConfig(array $tca)
Definition: TcaMigration.php:138
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateListWizardToFieldControl
‪array migrateListWizardToFieldControl(array $tca)
Definition: TcaMigration.php:1734
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateTranslationTable
‪array migrateTranslationTable(array $tca)
Definition: TcaMigration.php:947
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateImageManipulationConfig
‪array migrateImageManipulationConfig(array $tca)
Definition: TcaMigration.php:2336
‪TYPO3\CMS\Core\Migrations\TcaMigration\sanitizeControlSectionIntegrity
‪array sanitizeControlSectionIntegrity(array $tca)
Definition: TcaMigration.php:2622
‪$fields
‪$fields
Definition: pages.php:4
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateIconsForFormFieldWizardToNewLocation
‪array migrateIconsForFormFieldWizardToNewLocation(array $tca)
Definition: TcaMigration.php:448
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides
‪array migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides(array $tca)
Definition: TcaMigration.php:294
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateT3editorWizardToRenderTypeT3editorIfNotEnabledByTypeConfig
‪array migrateT3editorWizardToRenderTypeT3editorIfNotEnabledByTypeConfig(array $tca)
Definition: TcaMigration.php:164
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateFullScreenRichtextToFieldControl
‪array migrateFullScreenRichtextToFieldControl(array $tca)
Definition: TcaMigration.php:2021
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateLastPiecesOfDefaultExtras
‪array migrateLastPiecesOfDefaultExtras(array $tca)
Definition: TcaMigration.php:1831
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSelectShowIconTable
‪array migrateSelectShowIconTable(array $tca)
Definition: TcaMigration.php:2293
‪TYPO3\CMS\Core\Migrations\TcaMigration\getMessages
‪array getMessages()
Definition: TcaMigration.php:104
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateAddWizardToFieldControl
‪array migrateAddWizardToFieldControl(array $tca)
Definition: TcaMigration.php:1631
‪TYPO3\CMS\Core\Migrations\TcaMigration\$messages
‪array $messages
Definition: TcaMigration.php:32
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateTableWizardToRenderType
‪array migrateTableWizardToRenderType(array $tca)
Definition: TcaMigration.php:1924
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateIconfileRelativePathOrFilenameOnlyToExtReference
‪array migrateIconfileRelativePathOrFilenameOnlyToExtReference(array $tca)
Definition: TcaMigration.php:578
‪TYPO3\CMS\Core\Configuration\Features
Definition: Features.php:54
‪TYPO3\CMS\Core\Migrations\TcaMigration\validateTcaType
‪validateTcaType(array $tca)
Definition: TcaMigration.php:114
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateShowIfRteOption
‪array migrateShowIfRteOption(array $tca)
Definition: TcaMigration.php:898
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateDefaultExtrasRteTransFormOptions
‪array migrateDefaultExtrasRteTransFormOptions(array $tca)
Definition: TcaMigration.php:746
‪TYPO3\CMS\Core\Migrations
Definition: TcaMigration.php:3
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateWizardEnableByTypeConfigToColumnsOverrides
‪array migrateWizardEnableByTypeConfigToColumnsOverrides(array $tca)
Definition: TcaMigration.php:1155
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSelectTreeOptions
‪array migrateSelectTreeOptions(array $tca)
Definition: TcaMigration.php:814
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateinputDateTimeMax
‪array migrateinputDateTimeMax(array $tca)
Definition: TcaMigration.php:2399
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateEditWizardToFieldControl
‪array migrateEditWizardToFieldControl(array $tca)
Definition: TcaMigration.php:1544
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateInputDateTimeToRenderType
‪array migrateInputDateTimeToRenderType(array $tca)
Definition: TcaMigration.php:1119
‪TYPO3\CMS\Core\Migrations\TcaMigration\deprecateTypeGroupInternalTypeFile
‪array deprecateTypeGroupInternalTypeFile(array $tca)
Definition: TcaMigration.php:2590
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateInlineOverrideChildTca
‪array migrateInlineOverrideChildTca(array $tca)
Definition: TcaMigration.php:2424
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateLinkWizardToRenderTypeAndFieldControl
‪array migrateLinkWizardToRenderTypeAndFieldControl(array $tca)
Definition: TcaMigration.php:1437
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateShowItemAdditionalPaletteToOwnPalette
‪array migrateShowItemAdditionalPaletteToOwnPalette(array $tca)
Definition: TcaMigration.php:394
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateInlineLocalizationMode
‪array migrateInlineLocalizationMode(array $tca)
Definition: TcaMigration.php:1055
‪TYPO3\CMS\Core\Migrations\TcaMigration\migratePageLocalizationDefinitions
‪array migratePageLocalizationDefinitions(array $tca)
Definition: TcaMigration.php:1007
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateLocalizeChildrenAtParentLocalization
‪array migrateLocalizeChildrenAtParentLocalization(array $tca)
Definition: TcaMigration.php:2529
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateTSconfigSoftReferences
‪array migrateTSconfigSoftReferences(array $tca)
Definition: TcaMigration.php:855
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSelectWizardToValuePicker
‪array migrateSelectWizardToValuePicker(array $tca)
Definition: TcaMigration.php:1300
‪$tca
‪$tca
Definition: sys_file_metadata.php:4
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateExtAndSysextPathToEXTPath
‪array migrateExtAndSysextPathToEXTPath(array $tca)
Definition: TcaMigration.php:507
‪TYPO3\CMS\Core\Migrations\TcaMigration\migratePagesLanguageOverlayRemoval
‪array migratePagesLanguageOverlayRemoval(array $tca)
Definition: TcaMigration.php:2567
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateWorkspacesOptions
‪array migrateWorkspacesOptions(array $tca)
Definition: TcaMigration.php:923
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateColorPickerWizardToRenderType
‪array migrateColorPickerWizardToRenderType(array $tca)
Definition: TcaMigration.php:1232
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSelectFieldIconTable
‪array migrateSelectFieldIconTable(array $tca)
Definition: TcaMigration.php:668
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateSuggestWizardTypeGroup
‪array migrateSuggestWizardTypeGroup(array $tca)
Definition: TcaMigration.php:2136
‪TYPO3\CMS\Core\Migrations\TcaMigration\migrateIconsInOptionTags
‪array migrateIconsInOptionTags(array $tca)
Definition: TcaMigration.php:553