Reputation: 1344
I built an extension using extension builder and added a plugin for this. I would like to add plugin options at the time of adding the plugin to the page, which will determine the controller action for that page. Say I have two pages List
and Search
, I should be able to give the plugin option to choose MyExtController->list
for List
page and MyExtController->search
for Search
page.
So far I did this:
In my ext_tables.php
:
$pluginSignature = str_replace('_','',$_EXTKEY) . 'myext';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_myext.xml');
my FlexForm in Configuration/FlexForms:
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Function</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<switchableControllerActions>
<TCEforms>
<label>Select function</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">List</numIndex>
<numIndex index="1">MyExtController->list</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">Search</numIndex>
<numIndex index="1">MyExtController->search</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</switchableControllerActions>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
Somehow, I think i'm missing something. This does not work. Am I doing it right ? I do not see any plugin options.
Upvotes: 4
Views: 1196
Reputation: 55798
You missed the underscore in the $pluginSignature
it should be:
$pluginSignature = str_replace('_','',$_EXTKEY) . '_myext'
// ^-here
Also keep in mind that '_myext'
should be lower cased name of your plugin (no the ext) (that string which you register as a second argument of the registerPlugin
method)
Upvotes: 3