TYPO3的FlexForm未显示出来。

4
这是我的代码。我不知道哪里错了?请参考以下代码并帮助我。
$pluginSignature = str_replace('_','',$_EXTKEY) . '_rock';

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'Rocktechnolabs.' . $_EXTKEY, 'rock', 'THE FAQS' );

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

in Configuration/FlexForms/flexform_rock.xml

<T3DataStructure>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>Function</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <switchableControllerActions>
                        <TCEforms>
                            <label>Select function</label>
                            <config>
                                <type>select</type>
                                <items>
                                    <numIndex index="0">
                                        <numIndex index="0">List</numIndex>
                                        <numIndex index="1">Faq->list</numIndex>
                                    </numIndex>
                                    <numIndex index="1">
                                        <numIndex index="0">Search</numIndex>
                                        <numIndex index="1">Faq->search</numIndex>
                                    </numIndex>
                                </items>
                            </config>
                        </TCEforms>
                    </switchableControllerActions>
                </el>
            </ROOT>
        </sDEF>
    </sheets>
</T3DataStructure>

我尝试了很多次,但在选择插件时无法获取Flexform。您能帮助我找出错误吗?

2个回答

3

您需要将flexform字段添加到subtypes_addlist中:

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

谢谢你的回答。我忘记了这个,我刚刚添加了它,现在它可以工作了,谢谢。 - Sameer Bhayani
在出现错误的情况下,验证生成的 $TCA 可以帮助您了解 TYPO3 真正执行了什么操作。请在您的扩展文件 tt_content.php 的末尾添加以下代码:debug ($GLOBALS['TCA']['tt_content']['types'], '$GLOBALS[\'TCA\'][\'tt_content\'][\'types\']'); debug ($GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'], ' $GLOBALS[\'TCA\'][\'tt_content\'][\'columns\'][\'list_type\'][\'config\'][\'items\']'); - Franz Holzinger

2

请确保您的$pluginSignatureExtensionUtility::registerPlugin()中的$pluginSignature匹配。

这是该方法中正在发生的事情:

    $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
    $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName);

在我看来,这看起来有所不同 :)

正如Rene所建议的那样,添加$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';也很重要。


我已经注意到 $extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);。但是在构建 $pluginSignature 时,与以下 strtolower() 相关联,如果扩展键按照通常的规则构建(不使用大写字母,不使用空格),则所有结果都将相同。请注意:如果您在 /Configuration/TCA/... 中,则常量 _EXTKEY 不可用。 - Bernd Wilke πφ
感谢Mathias分享知识,我是TYPO3的新手,这将对我很有帮助。是的,我也想感谢Bernd在评论中分享的知识 :) - Sameer Bhayani

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接