Typo3 8.7.10 可切换控制器操作不起作用

Typo3 8.7.10 Switchable Controller Actions not working

通过研究示例,我尝试为我的扩展插件创建一个可切换的控制操作,但它没有显示出来。谁能帮我弄清楚为什么?

在我的 ext_localconf.php 中,我有以下内容:

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

在我的 ext_tables.php 我有以下内容:

\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');

在我的 Configuration/FlexForms/flexform_pi1.xml 我有以下内容:

<?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>

当我包含该插件时,我没有看到我创建的附加 select 菜单,因此我无法指定我希望它调用哪个操作。

我认为 $pluginSignature 变量可能由于大小写不正确。因此在ext_tables.php中尝试了以下方法:

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

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

 $pluginSignature = 'myeventplugin_Pi1';       

 $pluginSignature = 'myeventplugin_pi1';

...但仍然没有运气

我看看我的最后一个扩展:在 ext_tables.php 我写了

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

所以,我的情况是 $pluginSignature = 'thoffer_plg',在你的情况下它必须是 'myeventplugin_pi1'.

下一行:

            $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');

这对我来说很实用,在你的情况下它看起来还不错。如果您更改 flexforms 的值,最好的方法是重新安装扩展,因为这通常是深度缓存的。