如何在 TYPO3 7.6 扩展中提供自定义 FE 插件设置?

How to offer custom FE plugin settings in TYPO3 7.6 extensions?

通常您使用 flexforms 来提供自定义 TYPO3 插件设置。所以我在 ext_tables.php:

中设置了以下几行
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'DS.Dscontrolpanel',
    'Dsentitymodullist',
    'Entitymodullist'
);

// ...

// Flexform
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dscontrolpanel_entitymodullist'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dscontrolpanel_entitymodullist','FILE:EXT:dscontrolpanel/Configuration/FlexForms/flexform_dscontrolpanel.xml');

然后开始一点测试 flexform 来测试它 (flexform_dscontrolpanel.xml):

<T3DataStructure>
<ROOT>
    <TCEforms>
        <sheetTitle>Test 1</sheetTitle>
    </TCEforms>
    <type>array</type>
    <el>
        <test>
            <TCEforms>
                <label>Test 2</label>
                <config>
                    <default>1</default>
                    <type>check</type>
                    <items type="array">
                        <numIndex index="1" type="array">
                            <numIndex index="0">enabled</numIndex>
                            <numIndex index="1">1</numIndex>
                        </numIndex>
                    </items>
                </config>
            </TCEforms>
        </test>
    </el>
</ROOT>

之后我清除了 TYPO3 缓存和 PHP 操作码缓存。但是在我的 FE 插件表单中没有任何反应。 TYPO3 7.6+ 中是否有一种新方法可以将自定义设置添加到 TYPO3 FE 插件,或者我只是错过了什么?

我认为您构建错误的插件签名。

dscontrolpanel_dsentitymodullist 而不是 dscontrolpanel_entitymodullist

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'DS.Dscontrolpanel',
    'Dsentitymodullist',
    'Entitymodullist'
);

// ...

// Flexform                                                                        vv
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dscontrolpanel_dsentitymodullist'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
//                  vv
    'dscontrolpanel_dsentitymodullist',
    'FILE:EXT:dscontrolpanel/Configuration/FlexForms/flexform_dscontrolpanel.xml'
);

你为什么不注册一个前端插件呢?然后它会自动为你生成一个flexform,你可以扩展它,而且它会默认给你这个

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

我不会改变我的第一个答案,但显然我错了。按照这些步骤,您将能够添加您的 FlexForm:

以防万一

$pluginSignature = str_replace('_', '', $extKey) . '_yourextensionKey';

注册您的 FlexForm:

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';

找到您的 FlexForm:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $extKey . '/Configuration/FlexForms/FlexFormNameHere.xml');