我正在开发一个TYPO3 Extbase-Extension,它从XML-API获取事件。 扩展包括1个控制器和2个操作。
所以我的ext_localconf.php
看起来有点像这样:
Tx_Extbase_Utility_Extension::configurePlugin($_EXTKEY, 'pi1', array(
'Api' => 'latest,full'
),
array(
'Api' => 'latest,full'
));
操作的内容几乎相同,latest
- 操作仅从API中提取3个事件,full
- 操作从API获取所有事件。此外,他们确实以不同的方式呈现事件,这意味着他们使用不同的模板。
现在在Page A
的TYPO3-Backend中,我添加了一个类型为plugin
的新内容。我选择我的插件保存内容。在前端,输出latest
- 插件动作产生的结果。
但是在Page B
上,我还想使用相同的插件,但想要输出full
- 操作的结果。
我有点困惑。如何在后端的下拉列表中选择操作?
关于TYPO3的文档非常糟糕,缺乏大量信息,所以我在这里寻求帮助。
我发现的所有示例只涉及一个动作。
答案 0 :(得分:1)
你必须为插件创建一个flexform,或者如果你的插件有一个flexform,现在只需添加以下内容。
为了能够在插件中选择操作和控制器,您需要在flexform中使用switchableControllerActions
。
<switchableControllerActions>
<TCEforms>
<label>View</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<items type="array">
<numIndex index="1" type="array">
<numIndex index="0">Latest events</numIndex>
<numIndex index="1">Api->latest;</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">All events</numIndex>
<numIndex index="1">Api->full;</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</switchableControllerActions>
如果您没有Flexform for extension,请在Configuration / Flexform文件夹中创建一个。检查此链接。 https://wiki.typo3.org/Extension_Development,_using_Flexforms