我的flexform配置没有显示出来

时间:2017-07-25 06:40:28

标签: typo3

我试图配置我自己扩展的FE插件。我试过的flexform配置没有显示在后端。 为什么它不起作用,我需要改变什么?

我正在使用Typo3 8.7.3。

以下是相关的代码部分:

ext_tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
  'Fmogge.'.$extKey,
  'Nextcourse',
  'Nächste Kurse'
);

$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$frontendpluginName = 'Nextcourse';
$pluginSignature = strtolower($extensionName).'_'.strtolower($frontendpluginName);
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY.'/Configuration/FlexForms/Nextcourse.xml');

配置/ FlexForms / Nextcourse.xml

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>Optionen</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <settings.ort>
                    <TCEforms>
                        <label>Ort wählen</label>
                        <config>
                            <type>select</type>
                            <items type="array">
                                <numIndex index="0" type="array">
                                    <numIndex index="0"></numIndex>
                                    <numIndex index="1"></numIndex>
                                </numIndex>
                            </items>
                            <foreign_table>tx_coursemanager_domain_model_ort</foreign_table>
                              <foreign_table_where>
                                 AND elterndatensatz = 0
                              </foreign_table_where>
                        </config>
                    </TCEforms>
                </settings.ort>
            </el>
        </ROOT>
    </sDEF>
</sheets>

2 个答案:

答案 0 :(得分:0)

在你的ext_tables.php中将 $ extKey 更改为 $ _ EXTKEY 的语法,它将解决您的问题,例如:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
  'Fmogge.'.$_EXTKEY,
  'Nextcourse',
  'Nächste Kurse'
);

$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$frontendpluginName = 'Nextcourse';
$pluginSignature = strtolower($extensionName).'_'.strtolower($frontendpluginName);
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY.'/Configuration/FlexForms/Nextcourse.xml');

提示:将来避免使用$ _EXTKEY,而是使用扩展键作为字符串。它已在核心和各种第三方扩展中进行了更改。当您将此类配置移动到文件夹Configuration / TCA / ..时,$ _EXTKEY不可用,这会有所帮助。

您的flexform文件错过 T3DataStructure 的结束标记,如:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>Optionen</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <settings.ort>
                        <TCEforms>
                            <label>Ort wählen</label>
                            <config>
                                <type>select</type>
                                <items type="array">
                                    <numIndex index="0" type="array">
                                        <numIndex index="0"></numIndex>
                                        <numIndex index="1"></numIndex>
                                    </numIndex>
                                </items>
                                <foreign_table>tx_coursemanager_domain_model_ort</foreign_table>
                                  <foreign_table_where>
                                     AND elterndatensatz = 0
                                  </foreign_table_where>
                            </config>
                        </TCEforms>
                    </settings.ort>
                </el>
            </ROOT>
        </sDEF>
    </sheets>
<T3DataStructure>

答案 1 :(得分:0)

您可以使用下面的GLOBAL个变量。这对我有用。

只需替换ext_tables.php文件

中的以下行
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';