-
Notifications
You must be signed in to change notification settings - Fork 30
[TASK] Make the plugin a CType
#1960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,8 @@ | |
| ->services() | ||
| ->defaults() | ||
| ->autowire() | ||
| ->autoconfigure(); | ||
| ->autoconfigure() | ||
| ->public(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed for this PR? If so, why? |
||
|
|
||
| $services | ||
| ->load('TTN\\Tea\\', '../Classes/*') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,68 @@ | ||
| <?php | ||
|
|
||
| use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
| use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
| use TYPO3\CMS\Extbase\Utility\ExtensionUtility; | ||
|
|
||
| defined('TYPO3') || die(); | ||
|
|
||
| call_user_func( | ||
| static function (): void { | ||
| // This makes the plugin selectable in the BE. | ||
| $indexPluginSignature = ExtensionUtility::registerPlugin( | ||
| // extension name, matching the PHP namespaces (but without the vendor) | ||
| 'Tea', | ||
| // arbitrary, but unique plugin name (not visible in the BE) | ||
| 'TeaIndex', | ||
| // plugin title, as visible in the drop-down in the BE | ||
| 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_index', | ||
| // the icon visible in the drop-down in the BE | ||
| 'EXT:tea/Resources/Public/Icons/Extension.svg', | ||
| /** | ||
| * Add new select group for content element | ||
| */ | ||
| ExtensionManagementUtility::addTcaSelectItemGroup( | ||
| 'tt_content', | ||
| 'CType', | ||
| 'tea', | ||
| 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.pluginGroup', | ||
| 'after:default' | ||
| ); | ||
|
|
||
| // These two commands add the flexform configuration for the plugin. | ||
| $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$indexPluginSignature] = 'pi_flexform'; | ||
| ExtensionManagementUtility::addPiFlexFormValue( | ||
| $indexPluginSignature, | ||
| 'FILE:EXT:tea/Configuration/FlexForms/TeaIndex.xml', | ||
| ); | ||
| /** | ||
| * Register all plugins | ||
| */ | ||
| $plugins = ['tea_index', 'tea_show', 'tea_front_end_editor']; | ||
|
|
||
| $showPluginSignature = ExtensionUtility::registerPlugin( | ||
| 'Tea', | ||
| 'TeaShow', | ||
| 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_show', | ||
| 'EXT:tea/Resources/Public/Icons/Extension.svg', | ||
| ); | ||
| foreach ($plugins as $contentType) { | ||
| // This makes the plugin selectable in the BE. | ||
| ExtensionUtility::registerPlugin( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // extension name, matching the PHP namespaces (but without the vendor) | ||
| 'Tea', | ||
| // arbitrary, but unique plugin name (not visible in the BE) | ||
| GeneralUtility::underscoredToUpperCamelCase($contentType), | ||
| // plugin title, as visible in the drop-down in the BE | ||
| 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.' . $contentType, | ||
| // the icon visible in the drop-down in the BE | ||
| 'EXT:tea/Resources/Public/Icons/Extension.svg', | ||
| 'tea' | ||
| ); | ||
|
|
||
| $editorPluginSignature = ExtensionUtility::registerPlugin( | ||
| 'Tea', | ||
| 'TeaFrontEndEditor', | ||
| 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_frontend_editor', | ||
| 'EXT:tea/Resources/Public/Icons/Extension.svg', | ||
| ); | ||
| } | ||
|
|
||
| // These two commands add the flexform configuration for the plugin. | ||
| $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$editorPluginSignature] = 'pi_flexform'; | ||
| // Add the FlexForm to the show item list | ||
| ExtensionManagementUtility::addToAllTCAtypes( | ||
| 'tt_content', | ||
| '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin, pi_flexform', | ||
| 'tea_teaindex', | ||
| 'after:palette:headers' | ||
| ); | ||
| // Add the flexform configuration for the TeaIndex plugin. | ||
| ExtensionManagementUtility::addPiFlexFormValue( | ||
| '*', | ||
| 'FILE:EXT:tea/Configuration/FlexForms/TeaIndex.xml', | ||
| 'tea_teaindex' | ||
| ); | ||
| // Add the flexform configuration for the FE editor plugin. | ||
| ExtensionManagementUtility::addPiFlexFormValue( | ||
| $editorPluginSignature, | ||
| 'FILE:EXT:tea/Configuration/FlexForms/FrontEndEditor.xml' | ||
| '*', | ||
| 'FILE:EXT:tea/Configuration/FlexForms/FrontEndEditor.xml', | ||
| 'tea_front_end_editor' | ||
| ); | ||
|
|
||
| // This removes the default controls from the plugins. | ||
| $controlsToRemove = 'recursive,pages'; | ||
| $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$indexPluginSignature] = $controlsToRemove; | ||
| $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$showPluginSignature] = $controlsToRemove; | ||
| $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$editorPluginSignature] = $controlsToRemove; | ||
| }, | ||
| /** | ||
| * Register TeaIndex as "Insert Record" | ||
| */ | ||
| ExtensionManagementUtility::addToInsertRecords('tea_index'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do this, we should have the other plugins as well. |
||
| } | ||
| ); | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,18 @@ | |||||
| <source>Visible</source> | ||||||
| <target>Sichtbar</target> | ||||||
| </trans-unit> | ||||||
| </body> | ||||||
| <trans-unit id="tx_tea_domain_model_tea.pluginGroup"> | ||||||
| <source>Tea plugins</source> | ||||||
| <target>Tea</target> | ||||||
| </trans-unit> | ||||||
| <trans-unit id="plugin.tea_index.title"> | ||||||
| <source>Tea Index</source> | ||||||
| <target>Teeliste</target> | ||||||
| </trans-unit> | ||||||
| <trans-unit id="plugin.tea_index.description"> | ||||||
| <source>Tea plugin to show the listview.</source> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(also in the other file) |
||||||
| <target>Tea Plugin für eine Listenansicht.</target> | ||||||
| </trans-unit> | ||||||
| </body> | ||||||
| </file> | ||||||
| </xliff> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| "tt_content" | ||
| ,"uid","pid","CType","header","list_type","pi_flexform" | ||
| ,1,1,"list","Tea FrontEnd Editor","tea_teafrontendeditor","<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes"" ?> | ||
| <T3FlexForms> | ||
| <data> | ||
| <sheet index=""pagesAndFolders""> | ||
| <language index=""lDEF""> | ||
| <field index=""persistence.storagePid""> | ||
| <value index=""vDEF"">2</value> | ||
| </field> | ||
| </language> | ||
| </sheet> | ||
| </data> | ||
| </T3FlexForms>" | ||
| ,"uid","pid","CType","header","pi_flexform" | ||
| ,1,1,"tea_teafrontendeditor","Tea FrontEnd Editor","<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes"" ?> | ||
| <T3FlexForms> | ||
| <data> | ||
| <sheet index=""pagesAndFolders""> | ||
| <language index=""lDEF""> | ||
| <field index=""persistence.storagePid""> | ||
| <value index=""vDEF"">2</value> | ||
| </field> | ||
| </language> | ||
| </sheet> | ||
| </data> | ||
| </T3FlexForms>" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| "tt_content" | ||
| ,"uid","pid","CType","header","list_type","pi_flexform" | ||
| ,1,1,"list","Tea index","tea_teaindex","<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes"" ?> | ||
| ,"uid","pid","CType","header","pi_flexform" | ||
| ,1,1,"tea_teaindex","Tea index","<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes"" ?> | ||
| <T3FlexForms> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should indent the XML to align with the |
||
| <data> | ||
| <sheet index=""pagesAndFolders""> | ||
|
|
@@ -18,4 +18,4 @@ | |
| </sheet> | ||
| </data> | ||
| </T3FlexForms>" | ||
| ,2,3,"list","Tea show","tea_teashow","" | ||
| ,2,3,"tea_teashow","Tea show","" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ | |
| "psr/http-message": "^1.0.1", | ||
| "typo3/cms-core": "^12.4.41", | ||
| "typo3/cms-extbase": "^12.4.41 || ^13.4", | ||
| "typo3/cms-fluid": "^12.4.41 || ^13.4", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this needs to stay as we have Fluid templates. |
||
| "typo3/cms-frontend": "^12.4.41 || ^13.4" | ||
| }, | ||
| "require-dev": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| use TTN\Tea\Controller\FrontEndEditorController; | ||
| use TTN\Tea\Controller\TeaController; | ||
| use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
| use TYPO3\CMS\Extbase\Utility\ExtensionUtility; | ||
|
|
||
| defined('TYPO3') or die('Access denied.'); | ||
|
|
@@ -21,7 +22,8 @@ | |
| // non-cacheable actions | ||
| [ | ||
| TeaController::class => '', | ||
| ] | ||
| ], | ||
| ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT | ||
| ); | ||
| ExtensionUtility::configurePlugin( | ||
| 'Tea', | ||
|
|
@@ -31,7 +33,8 @@ | |
| ], | ||
| [ | ||
| TeaController::class => '', | ||
| ] | ||
| ], | ||
| ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT | ||
| ); | ||
|
|
||
| // This makes the plugin available for front-end rendering. | ||
|
|
@@ -49,5 +52,8 @@ | |
| // All actions need to be non-cacheable because they either contain dynamic data, | ||
| // or because they are specific to the logged-in FE user (while FE content is cached by FE groups). | ||
| FrontEndEditorController::class => 'index, edit, update, create, new, delete', | ||
| ] | ||
| ], | ||
| ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT | ||
| ); | ||
|
|
||
| ExtensionManagementUtility::addPageTSConfig('@import \'EXT:tea/Configuration/TSconfig/Page/ContentElementWizard.tsconfig\''); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not exist, and this PR does not introduce it. So this line should be removed. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to the upgrade wizard (which is not part of this PR). So we don't need the changed to this file in this PR.