mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-20 01:36:14 +02:00

[TASK] Replace switchable controller actions (#575)

This commit is contained in:
Łukasz Uznański 2022-09-27 11:53:43 +02:00 committed by GitHub
parent 9c3e8abd24
commit 2484f6d8ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 69 deletions

View file

@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Added ### Added
### Changed ### Changed
- Replace switchable controller actions with separate plugins (#575)
### Deprecated ### Deprecated

View file

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<T3DataStructure>
<sheets>
<general>
<ROOT>
<TCEforms>
<!--
The sheet title will not be visible in the BE. Still, the XML element needs to be present to
avoid a crash in the BE.
-->
<sheetTitle/>
</TCEforms>
<type>array</type>
<el>
<switchableControllerActions>
<TCEforms>
<label>LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.view</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.index</numIndex>
<numIndex index="1">Tea->index</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.show</numIndex>
<numIndex index="1">Tea->show</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</switchableControllerActions>
</el>
</ROOT>
</general>
</sheets>
</T3DataStructure>

View file

@ -7,18 +7,23 @@ defined('TYPO3') || die();
// extension name, matching the PHP namespaces (but without the vendor) // extension name, matching the PHP namespaces (but without the vendor)
'Tea', 'Tea',
// arbitrary, but unique plugin name (not visible in the BE) // arbitrary, but unique plugin name (not visible in the BE)
'Tea', 'TeaIndex',
// plugin title, as visible in the drop-down in the BE // plugin title, as visible in the drop-down in the BE
'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea', 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_index',
// the icon visible in the drop-down in the BE // the icon visible in the drop-down in the BE
'EXT:tea/Resources/Public/Icons/Extension.svg' 'EXT:tea/Resources/Public/Icons/Extension.svg'
); );
// This removes the default controls from the plugin. \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['tea_tea'] = 'recursive,select_key,pages'; 'Tea',
// These two commands add the flexform configuration for the plugin. 'TeaShow',
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['tea_tea'] = 'pi_flexform'; 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_show',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( 'EXT:tea/Resources/Public/Icons/Extension.svg'
'tea_tea',
'FILE:EXT:tea/Configuration/FlexForms/Plugin.xml'
); );
// This removes the default controls from the plugin.
$controlsToRemove = 'recursive,select_key,pages';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'] = [
'tea_teaindex' => $controlsToRemove,
'tea_teashow' => $controlsToRemove,
];

View file

@ -3,19 +3,11 @@
<file source-language="en" target-language="de" datatype="plaintext" original="messages"> <file source-language="en" target-language="de" datatype="plaintext" original="messages">
<header/> <header/>
<body> <body>
<trans-unit id="plugin.tea"> <trans-unit id="plugin.tea_index">
<source>Tea</source>
<target>Tee</target>
</trans-unit>
<trans-unit id="plugin.tea.view">
<source>View</source>
<target>Ansicht</target>
</trans-unit>
<trans-unit id="plugin.tea.index">
<source>Tea list</source> <source>Tea list</source>
<target>Teeliste</target> <target>Teeliste</target>
</trans-unit> </trans-unit>
<trans-unit id="plugin.tea.show"> <trans-unit id="plugin.tea_show">
<source>Tea single view</source> <source>Tea single view</source>
<target>Tee-Einzelansicht</target> <target>Tee-Einzelansicht</target>
</trans-unit> </trans-unit>

View file

@ -3,16 +3,10 @@
<file source-language="en" datatype="plaintext" original="messages"> <file source-language="en" datatype="plaintext" original="messages">
<header/> <header/>
<body> <body>
<trans-unit id="plugin.tea"> <trans-unit id="plugin.tea_index">
<source>Tea</source>
</trans-unit>
<trans-unit id="plugin.tea.view">
<source>View</source>
</trans-unit>
<trans-unit id="plugin.tea.index">
<source>Tea list</source> <source>Tea list</source>
</trans-unit> </trans-unit>
<trans-unit id="plugin.tea.show"> <trans-unit id="plugin.tea_show">
<source>Tea single view</source> <source>Tea single view</source>
</trans-unit> </trans-unit>
<trans-unit id="index.heading"> <trans-unit id="index.heading">

View file

@ -25,7 +25,7 @@
{tea.uid} {tea.uid}
</td> </td>
<td> <td>
<f:link.action arguments="{tea: tea}" pageUid="{settings.singleViewPageUid}"> <f:link.action action="show" arguments="{tea: tea}" pageUid="{settings.singleViewPageUid}">
{tea.title} {tea.title}
</f:link.action> </f:link.action>
</td> </td>

View file

@ -8,14 +8,24 @@ defined('TYPO3') or die('Access denied.');
// extension name, matching the PHP namespaces (but without the vendor) // extension name, matching the PHP namespaces (but without the vendor)
'Tea', 'Tea',
// arbitrary, but unique plugin name (not visible in the BE) // arbitrary, but unique plugin name (not visible in the BE)
'Tea', 'TeaIndex',
// all actions // all actions
[ [
\TTN\Tea\Controller\TeaController::class => 'index, show', \TTN\Tea\Controller\TeaController::class => 'index',
], ],
// non-cacheable actions // non-cacheable actions
[ [
\TTN\Tea\Controller\TeaController::class => '', \TTN\Tea\Controller\TeaController::class => '',
] ]
); );
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Tea',
'TeaShow',
[
\TTN\Tea\Controller\TeaController::class => 'show',
],
[
\TTN\Tea\Controller\TeaController::class => '',
]
);
})(); })();