typo3 插件:如何传递参数?

typo3 plugin: how to pass a parameter?

我在 typo3 中有一个插件,例如,我在其中执行限制为 5 的数据库查询。 我现在正在寻找一种解决方案,以在 typo3 的后端(select 框、单选按钮等)中选择此限制并将其作为参数传递 - 你知道吗?

谢谢 沃尔克

我猜你正在使用基于 extbase 的扩展!该配置称为Flexforms,可以很容易地实现

举个例子,看看我的extensions:

Configuration/TCA/Overrides/tt_content.php 放置这样的代码

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

当然你需要根据你的需要采用它

flexform_mailchimp.xml

添加包含配置的 flexform 文件:

<T3DataStructure>
    <meta>
        <langDisable>1</langDisable>
    </meta>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>LLL:EXT:mailchimp/Resources/Private/Language/locallang.xml:flexform.title</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <settings.fo>
                        <TCEforms>
                            <label>LLL:EXT:mailchimp/Resources/Private/Language/locallang.xml:flexform.useAjax</label>
                            <config>
                                <type>input</type>
                                <default>0</default>
                            </config>
                        </TCEforms>
                    </settings.fo>
                </el>
            </ROOT>
        </sDEF>
    </sheets>
</T3DataStructure>

由于设置名为 settings.fo,您可以使用 $this->settings['fo'].

获取控制器中的值