Skip to content

Commit 346a10e

Browse files
committed
[BUGFIX] Add automatic migration for renderType inputLink
Fixes: #674
1 parent 2869a47 commit 346a10e

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

Classes/Definition/TcaFieldDefinition.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,12 @@ protected static function migrateTCA(array $definition, TcaFieldDefinition $tcaF
538538
unset($definition['config']['wizards']);
539539
}
540540

541+
// Migration for type Link in TYPO3 v12
542+
if (($definition['config']['renderType'] ?? '') === 'inputLink') {
543+
$definition['config']['type'] = 'link';
544+
unset($definition['config']['renderType']);
545+
}
546+
541547
// Migration for foreign_record_defaults Mask v2 / TYPO3 v7.
542548
if (isset($definition['config']['foreign_record_defaults'])) {
543549
$definition['config']['overrideChildTca']['columns']['colPos']['config']['default'] = 999;

Classes/Utility/FieldTypeUtility.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ public static function getFieldType(array $tca, string $fieldKey): FieldType
5858
if (in_array('double2', $evals, true)) {
5959
return FieldType::FLOAT;
6060
}
61-
if (($tca['config']['renderType'] ?? '') === 'inputLink') {
62-
return FieldType::LINK;
63-
}
6461
if (($tca['config']['renderType'] ?? '') === 'colorpicker') {
6562
return FieldType::COLORPICKER;
6663
}

Tests/Unit/Definition/TcaFieldDefinitionTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,26 @@ public static function createFromArrayWorksOnLegacyFormatDataProvider(): iterabl
387387
],
388388
];
389389

390+
yield 'Legacy inputLink is migrated to type link' => [
391+
'json' => [
392+
'key' => 'link',
393+
'fullKey' => 'tx_mask_link',
394+
'type' => 'link',
395+
'config' => [
396+
'type' => 'input',
397+
'renderType' => 'inputLink',
398+
],
399+
],
400+
'expected' => [
401+
'key' => 'link',
402+
'fullKey' => 'tx_mask_link',
403+
'type' => 'link',
404+
'config' => [
405+
'type' => 'link',
406+
],
407+
],
408+
];
409+
390410
yield 'Legacy Link fieldControl is migrated.' => [
391411
'json' => [
392412
'key' => 'link',

0 commit comments

Comments
 (0)