Skip to content

Commit

Permalink
Fix issues and add empty chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed Oct 25, 2024
1 parent b950841 commit 7ac12c6
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
46 changes: 43 additions & 3 deletions Documentation/ApiOverview/ContentElements/MigrationListType.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ Core-based plugin.

.. literalinclude:: _Migration/_tca_registration.php.diff
:caption: EXT:examples/Configuration/TCA/Overrides/tt_content.php (difference)
:linenos:

The `CType` based plugin does not inherit the standard fields provided by the
TCA of the content-element "List". These where in many cases removed by
TCA of the content element "List". These where in many cases removed by
using :confval:`subtypes_excludelist <t3tca:types-subtypes-excludelist>`.

As these fields are not displayed automatically anymore you can remove this
Expand All @@ -90,6 +91,8 @@ it to the `CType`.
----------------------------

.. versionadded:: 13.4
If your extension also should support TYPO3 version 12.4 or even 11.5 see
Example: :ref:`plugins-list-type-migration-core-plugin-migration`.

You can extend class :php-short:`TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate`
to provide a custom upgrade wizard that moves existing plugins from the
Expand All @@ -114,7 +117,44 @@ options
Migration example: Core-based plugin
====================================

.. _plugins-list-type-migration-core-registration:
.. _plugins-list-type-migration-core-plugin-registration:

1. Adjust the plugin registration
==================================
----------------------------------

.. literalinclude:: _Migration/_non_extbase_tca.diff
:caption: EXT:my_extension/Configuration/TCA/tt_content.php (diff)

.. _plugins-list-type-migration-core-plugin-typoscript:

2. Adjust the TypoScript of the plugin
---------------------------------------

If your plugin was rendered using :composer:`typo3/cms-fluid-styled-content` you are
probably using the top level TypoScript object
:ref:`tt_content <t3tsref:tlo-tt_content>` to render the plugin. The path to
the plugin rendering needs to be adjusted as you cannot use the deprecated content
element "list" anymore:

.. literalinclude:: _Migration/_typoscript.diff
:caption: EXT:my_extension/Configuration/Sets/MyPluginSet/setup.typoscript (diff)

.. _plugins-list-type-migration-core-plugin-migration:

3. Provide an upgrade wizard for automatic content migration for TYPO3 v13.4 and v12.4
---------------------------------------------------------------------------------------

If you extension only support TYPO3 v13 and above you can extend the Core class
:php:`\TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate`.

If your extension also supports TYPO3 v12 and maybe even TYPO3 v11 you can use
class :php:`Linawolf\ListTypeMigration\Upgrades\AbstractListTypeToCTypeUpdate`
instead. Require via composer: :composer:`linawolf/list-type-migration` or
copy the file into your extension using your own namespaces:

.. literalinclude:: _Migration/PluginListTypeToCTypeUpdate.php
:caption: EXT:my_extension/Classes/Upgrades/PluginListTypeToCTypeUpdate.php

If you also have to be compatible with TYPO3 v11, register the upgrade wizard
manually:
:ref:`Registering wizards for TYPO3 v11 <t3coreapi/11:upgrade-wizards-register>`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Upgrades;

# composer req linawolf/list-type-migration
use Linawolf\ListTypeMigration\Upgrades\AbstractListTypeToCTypeUpdate;
use TYPO3\CMS\Install\Attribute\UpgradeWizard;

#[UpgradeWizard('myExtensionPluginListTypeToCTypeUpdate')]
final class PluginListTypeToCTypeUpdate extends AbstractListTypeToCTypeUpdate
{

protected function getListTypeToCTypeMapping(): array
{
return [
'my_extension_pi1' => 'my_extension_pi1',
'my_extension_pi2' => 'my_extension_newpluginname',
];
}

public function getTitle(): string
{
return 'Migrates my_extension plugins';
}

public function getDescription(): string
{
return 'Migrates my_extension_pi1, my_extension_pi2 from list_type to CType. ';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$pluginSignature = 'examples_pi1';
$pluginTitle = 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.examples_pi1.title';
$extensionKey = 'examples';
$flexFormPath = 'FILE:EXT:examples/Configuration/Flexforms/flexform_ds1.xml';

// Add the plugins to the list of plugins
ExtensionManagementUtility::addPlugin(
[$pluginTitle, $pluginSignature, '', 'plugin'],
- 'list_type',
+ 'CType',
$extensionKey,
);

-// Disable the display of layout and select_key fields for the plugin
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature]
- = 'layout,select_key,pages';
-
-// Activate the display of the plug-in flexform field and set FlexForm definition
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';

+// Activate the display of the FlexForm field
+ExtensionManagementUtility::addToAllTCAtypes(
+ 'tt_content',
+ '--div--;Configuration,pi_flexform,',
+ $pluginSignature,
+ 'after:subheader',
+);

ExtensionManagementUtility::addPiFlexFormValue(
- $pluginSignature,
+ '*',
$flexFormPath,
+ $pluginSignature,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-tt_content.list.20.examples_pi1 = USER
-tt_content.list.20.examples_pi1 {
+tt_content.examples_pi1 = USER
+tt_content.examples_pi1 {
userFunc = MyVendor\Examples\Controller\ExampleController->example
settings {
singlePid = 42
listPid = 55
}
view {
templateRootPath = {$templateRootPath}
partialRootPath = {$partialRootPath}
layoutRootPath = {$layoutRootPath}
}
}

# Or if you used the plugin top level object:

-tt_content.list.20.examples_pi1 < plugin.tx_examples_pi1
+tt_content.examples_pi1 < plugin.tx_examples_pi1

0 comments on commit 7ac12c6

Please sign in to comment.