Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Ensure to have a default showitem info when adding plugins as …
…CType This change adds the basic information for a type when adding a plugin as CType. When adding a plugin with "list_type" (default), then the "list" CType is used, and extension authors are able to add or remove fields easily with the API. However, when encouraging extension authors to use CType, this is currently much more boilerplate and not possible to make this more flexible. As shown, EXT:felogin and EXT:form previously used this concept manually, which does not allow to extend fields properly, but extensions with plugins as CTypes had to define them explicitly. As TYPO3 Core encourages people to use custom CTypes in favor of list_type (moving towards a unifieid Content Block concept), this change will also be available for 11.5. Resolves: #98960 Releases: main, 11.5 Change-Id: Iee5e1a35f2d99faf03081d7265c2fe6e4845397f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76465 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Oliver Bartsch <bo@cedev.de>
- Loading branch information
Showing
5 changed files
with
141 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
.../Changelog/11.5.x/Important-98960-DefaultTypeDefinitionOfCustomContentTypes.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
.. _important-98960-1667212946: | ||
|
||
=================================================================== | ||
Important: #98960 - Default type definition of custom Content Types | ||
=================================================================== | ||
|
||
See :issue:`98960` | ||
|
||
Description | ||
=========== | ||
|
||
Due to the deprecation of Switchable Controller Actions for Extbase, it is | ||
recommended to use custom content types as plugins. When using Extbase's API | ||
:php:`\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin()` with | ||
the 5th argument being set to | ||
:php:`\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT` | ||
or TYPO3's native API :php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin()` | ||
with the second argument being set to `CType`, the entered icon identifier | ||
is now automatically added as `typeicon_classes` for the given `CType` and | ||
the `TCA` types definition (`showitem`) of the default `header` type is | ||
automatically applied, so extension authors do not need to add all default | ||
fields anymore. | ||
|
||
Note | ||
---- | ||
|
||
These defaults are only applied if they are not set manually, so the changes | ||
are optional defaults. | ||
|
||
In addition, the API method :php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes()` | ||
now also allows to add custom fields after a palette, so common variants such | ||
as the `Plugin` tab can be added after a specific palette. | ||
|
||
Example | ||
------- | ||
|
||
Example for a custom Extbase plugin with TYPO3's Core "felogin" extension | ||
in `EXT:felogin/Configuration/TCA/Overrides/tt_content.php`: | ||
|
||
.. code-block:: php | ||
call_user_func(static function () { | ||
$contentTypeName = 'felogin_login'; | ||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( | ||
'Felogin', | ||
'Login', | ||
'LLL:EXT:felogin/Resources/Private/Language/Database.xlf:tt_content.CType.felogin_login.title', | ||
'mimetypes-x-content-login', | ||
'forms' | ||
); | ||
// Add the FlexForm for the new content type | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( | ||
'*', | ||
'FILE:EXT:felogin/Configuration/FlexForms/Login.xml', | ||
$contentTypeName | ||
); | ||
// Add the FlexForm to the showitem list | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( | ||
'tt_content', | ||
'--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin, pi_flexform', | ||
$contentTypeName, | ||
'after:palette:headers' | ||
); | ||
}); | ||
.. index:: Backend, TCA, ext:core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters