typo3typo3-extensionstypo3-8.7.x

Typo3 8.7.10 Switchable Controller Actions not working


From researching examples I have tried to create a switchable control action for my extension plugin, but it is not showing up. Can anybody help me figure out why?

In my ext_localconf.php I have the following:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'myeventplugin',
        'Pi1',
        [
            'Events' => 'list, display'
        ],
        // non-cacheable actions
        [
            'Events' => 'list, display'
        ]
    );

In my ext_tables.php I have the following:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
        'myeventplugin',
        'Pi1',
        'Events'
);  

$pluginSignature = 'myeventplugin_Pi1';

$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:myeventplugin/Configuration/FlexForms/flexform_pi1.xml');

In my Configuration/FlexForms/flexform_pi1.xml I have the following:

<?xml version="1.0" encoding="UTF-8"?>
<T3DataStructure>
<sheets>
    <sDEF>
        <ROOT>
            <TCEforms>
                <sheetTitle>Events Plugin Config</sheetTitle>
            </TCEforms>
            <type>
                array
            </type>
            <el>
                <switchableControllerActions>
                    <TCEforms>
                        <label>View</label>
                        <onChange>reload</onChange>
                        <config>
                            <type>select</type>
                            <renderType>selectSingle</renderType>
                            <items type="array">
                                <numIndex index="0" type="array">
                                    <numIndex index="0">Event List</numIndex>
                                    <numIndex index="1">Events->list</numIndex>
                                </numIndex> 
                                <numIndex index="1" type="array">
                                    <numIndex index="0">Event Display</numIndex>
                                    <numIndex index="1">Events->display</numIndex>
                                </numIndex>               
                            </items>
                        </config>
                    </TCEforms>
                </switchableControllerActions>
            </el>
        </ROOT>
    </sDEF>
</sheets>
</T3DataStructure>

When I include the plugin I don't see the additional select menu that I have created, therefore I can't specify which action I want it to call.

I thought that perhaps the $pluginSignature variable was incorrect due to the casing. Therefore in ext_tables.php in have tried the following:

 $extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
 $pluginSignature = $extensionName.'_'.'Pi1';

and

 $extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
 $pluginSignature = $extensionName.'_'.'pi1'; 

and

 $pluginSignature = 'myeventplugin_Pi1';       

and

 $pluginSignature = 'myeventplugin_pi1';

...but still no luck


Solution

  • I have a look in my last extension: in ext_tables.php i wrote

        $extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extKey));
        $pluginName = strtolower('plg');
        $pluginSignature = $extensionName.'_'.$pluginName;
    

    so, im my case $pluginSignature = 'thoffer_plg', in your case it has to be 'myeventplugin_pi1'.

    Next lines:

                $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,pages,recursive';
                $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$extKey . '/Configuration/FlexForms/contentPlugin.xml');
    

    This is functional for me, in your case it looks ok. The best way is to reinstall the extension, if you change values for flexforms, because this is normally deeply cached.