通过研究示例,我尝试为我的扩展插件创建一个可切换的控制操作,但它没有显示。谁能帮我弄清楚为什么?
在我的ext_localconf.php中,我有以下内容:
TYPO3CMSExtbaseUtilityExtensionUtility::configurePlugin(
'myeventplugin',
'Pi1',
[
'Events' => 'list, display'
],
// non-cacheable actions
[
'Events' => 'list, display'
]
);
在我的ext_tables.php中,我有以下内容:
TYPO3CMSExtbaseUtilityExtensionUtility::registerPlugin(
'myeventplugin',
'Pi1',
'Events'
);
$pluginSignature = 'myeventplugin_Pi1';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
TYPO3CMSCoreUtilityExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:myeventplugin/Configuration/FlexForms/flexform_pi1.xml');
在我的配置/弹性表单/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>
当我包含插件时,我看不到我创建的其他选择菜单,因此我无法指定我希望它调用哪个操作。
我认为也许$pluginSignature变量由于大小写而不正确。因此,在ext_tables.php中尝试了以下方法:
$extensionName = strtolower(TYPO3CMSCoreUtilityGeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = $extensionName.'_'.'Pi1';
和
$extensionName = strtolower(TYPO3CMSCoreUtilityGeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = $extensionName.'_'.'pi1';
和
$pluginSignature = 'myeventplugin_Pi1';
和
$pluginSignature = 'myeventplugin_pi1';
。但仍然没有运气
我在上一个扩展中看了一下:在我写的ext_tables.php
$extensionName = strtolower(TYPO3CMSCoreUtilityGeneralUtility::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';
TYPO3CMSCoreUtilityExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$extKey . '/Configuration/FlexForms/contentPlugin.xml');
这对我来说是功能性的,在您的情况下看起来还可以。最好的方法是重新安装扩展,如果你更改了弹性表单的值,因为这通常是深度缓存的。