【问题标题】:TYPO3 FlexForm is not appearingTYPO3 FlexForm 没有出现
【发布时间】:2017-05-16 13:43:09
【问题描述】:

这是我的代码。不知道错在哪里?请参考以下代码并帮助我

$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。你能帮我找出错误吗?

【问题讨论】:

    标签: typo3


    【解决方案1】:

    您必须将 flexform 字段添加到 subtypes_addlist:

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

    【讨论】:

    • 谢谢你的回答..我忘记了,我刚刚添加了它,谢谢
    • 如果出现错误,它可以帮助验证生成的 $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\']');
    【解决方案2】:

    确保您的$pluginSignature 匹配$pluginSignatureExtensionUtility::registerPlugin() 的结果。

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

        $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);。但是与下面的strtolower() 相关联,在构建 $pluginSignature 时,如果扩展密钥建立在通常的规则上(没有大写,没有空格),所有结果都将相同。请注意:如果您在 /Configuration/TCA/...中,则常量 _EXTKEY 不可用...
    • 感谢 mathias 分享知识,我是typo3 的新手,所以它对我很有帮助,是的,我也要感谢 bernd 在评论中提供的知识:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-06
    • 1970-01-01
    • 2013-02-19
    • 2017-06-24
    • 2016-12-16
    • 2016-05-07
    • 1970-01-01
    相关资源
    最近更新 更多