Migration from subtypes to types 

Migrate plugins with FlexForms added via subtypes_addlist 

If you used plugins with the now deprecated subtypes, you probably used subtypes_addlist to display a FlexForm for configuration purposes.

Migrate by adding the field pi_flexform with the utility method ExtensionManagementUtility addToAllTCAtypes() instead. You also have to change the parameters used for method addPiFlexFormValue():

EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'my_extension',
     'Pi1',
     'List of blogs',
 );
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature]
-    = 'pi_flexform';

+ExtensionManagementUtility::addToAllTCAtypes(
+    'tt_content',
+    '--div--;Configuration,pi_flexform,pages,recursive,',
+    $pluginSignature,
+    'after:subheader',
+);
 ExtensionManagementUtility::addPiFlexFormValue(
-    $pluginSignature,
+    '*',
     'FILE:EXT:my_extension/Configuration/FlexForms/PluginSettings.xml',
+    $pluginSignature,
 );
Copied!

The fields pages and recursive used to be added automatically to plugins when using the now outdated subtype "list_type". Therefore they have to be added manually when doing the migration.

Migrate plugins with fields removed via subtypes_excludelist 

Many extension author used the now deprecated option subtypes_excludelist to hide these automatically added fields.

The same effect can now be used by simply not adding the fields in the first place:

EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'my_extension',
     'Pi1',
     'List of blogs',
 );
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature]
-    = 'pages,recursive';
Copied!

If any other fields have been removed with this method you can only remove them by overriding $GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['showitem'] or via page TSconfig.

Migrate custom tables using subtypes 

Replace any subtype_value_field configuration with dedicated record types. Please also consider migrating corresponding subtypes_addlist and subtypes_excludelist definitions accordingly.

In the following example, events of table tx_myextension_event used the subtype field event_format to show the field stream_url instead of location for online events. After the migration, online events are a record type of their own with their own showitem list:

EXT:my_extension/Configuration/TCA/tx_myextension_event.php
 return [
   'ctrl' => [
     'type' => 'type',
     // ...
   ],
   'columns' => [
     'type' => [
       'config' => [
         'type' => 'select',
         'renderType' => 'selectSingle',
         'items' => [
           ['label' => 'Event', 'value' => 'event'],
+          ['label' => 'Online event', 'value' => 'online_event'],
         ],
       ],
     ],
-    'event_format' => [
-      'config' => [
-        'type' => 'select',
-        'renderType' => 'selectSingle',
-        'items' => [
-          ['label' => 'On site', 'value' => 'on_site'],
-          ['label' => 'Online', 'value' => 'online'],
-        ],
-      ],
-    ],
     // ...
   ],
   'types' => [
     'event' => [
-      'showitem' => 'type, event_format, title, location',
-      'subtype_value_field' => 'event_format',
-      'subtypes_addlist' => [
-        'online' => 'stream_url',
-      ],
-      'subtypes_excludelist' => [
-        'online' => 'location',
-      ],
+      'showitem' => 'type, title, location',
+    ],
+    'online_event' => [
+      'showitem' => 'type, stream_url, title',
     ],
   ],
 ];
Copied!

subtypes_addlist inserted its fields directly after the subtype field, so stream_url takes the place of event_format in the new showitem list.

Existing records keep their old values. Update the type field of records that used the subtype, here all events with event_format set to online, to the new record type online_event. Then drop the subtype column.

Migration: PreviewRenderer for subtypes 

When migrating a plugin with a PreviewRenderer from list_type registration to its own CType change the PreviewRenderer configuration to the record type as well:

EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'my_extension',
     'Pi1',
     'List of blogs',
 );
-$GLOBALS['TCA']['tt_content']['types']['list_type']['previewRenderer'][$pluginSignature]
-        = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
+$GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['previewRenderer']
+        = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Copied!