You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3自定义内容元素添加Flexform字段缺失及前端报错问题

TYPO3自定义内容元素Flexform配置问题

我需要在TYPO3的自定义内容元素中添加Flexform配置,目标是实现和bootstrap_package扩展完全一致的字段效果:
目标字段效果

完成现有配置后,后台实际显示的字段效果和预期不符,当前效果如下:
当前字段效果


已编写代码

$GLOBALS['TCA']['tt_content']['types']['carousel_klassenfahrt'] = array_replace_recursive(
    $GLOBALS['TCA']['tt_content']['types']['carousel_klassenfahrt'],
    [
        'showitem' => '
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,
                tx_carousel_klassenfahrt_item,
            --div--;Options,
                pi_flexform;Advanced,
            --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                --palette--;;language,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                --palette--;;hidden,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
                categories,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
                rowDescription,
            --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
        '
    ]
);

// Add flexForms for content element configuration
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    '*',
    'FILE:EXT:myextensionkey/Configuration/FlexForms/Klassenfahrt.xml',
    'Klassenfahrt'
);

Klassenfahrt.xml 文件代码

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
    <meta>
        <langDisable>1</langDisable>
    </meta>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>Settings</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <interval>
                        <TCEforms>
                            <label>Interval in ms</label>
                            <config>
                                <type>input</type>
                                <size>8</size>
                                <default>5000</default>
                                <eval>required,int</eval>
                            </config>
                        </TCEforms>
                    </interval>
                    <transition>
                        <TCEforms>
                            <label>Transition</label>
                            <config>
                                <type>select</type>
                                <renderType>selectSingle</renderType>
                                <default>fade</default>
                                <items type="array">
                                    <numIndex index="0" type="array">
                                        <numIndex index="0">Fade</numIndex>
                                        <numIndex index="1">fade</numIndex>
                                    </numIndex>
                                    <numIndex index="1" type="array">
                                        <numIndex index="0">Slide</numIndex>
                                        <numIndex index="1">slide</numIndex>
                                    </numIndex>
                                </items>
                            </config>
                        </TCEforms>
                    </transition>
                    <wrap>
                        <TCEforms>
                            <label>LLL:EXT:Wrap</label>
                            <config>
                                <type>check</type>
                                <default>1</default>
                                <items type="array">
                                    <numIndex index="0" type="array">
                                        <numIndex index="0">Start the Carousel from the beginning once it has arrived at the end.</numIndex>
                                    </numIndex>
                                </items>
                            </config>
                        </TCEforms>
                    </wrap>
                    <show_nav_title>
                        <TCEforms>
                            <label>Show Navigation Title</label>
                            <config>
                                <type>check</type>
                                <default>0</default>
                                <items type="array">
                                    <numIndex index="0" type="array">
                                        <numIndex index="0">Show the navigation title of the records instead of the bubbles.</numIndex>
                                    </numIndex>
                                </items>
                            </config>
                        </TCEforms>
                    </show_nav_title>
                </el>
            </ROOT>
        </sDEF>
    </sheets>
</T3DataStructure>

tt_content.php 文件代码

$pluginSignature = str_replace('_', '', 'myextensionkey') . '_pi1';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    $pluginSignature,
    // Flexform configuration schema file
    'FILE:EXT:myextensionkey/Configuration/FlexForms/Klassenfahrt.xml'
);

待解决问题

  • 还需要补充哪些代码才能实现预期的字段效果?
  • 在Typoscript中添加如下配置后,前端抛出错误Oops, an error occurred! Code: 202206171326512224c926,求对应解决方案,出错配置如下:
dataProcessing.10 = RASANIDESIGN\KlassenFahrt\DataProcessing\FlexFormProcessor

内容的提问来源于stack exchange,提问作者Mi Neu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.30 09:21:34