TYPO3 - 将flexform添加到我自己的扩展中

时间:2015-01-29 16:03:38

标签: fluid extbase typo3-6.2.x

我正在构建自己的扩展程序。 我找到了关于将Flexform添加到Extension的页面 https://gist.github.com/alrnz/c0f00b196d378f5b9150

在我的ext_tables.php中,我有这个:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    $_EXTKEY,
    'Xlsxtotables',
    'XLSX to tables'
);

// Include flex forms
$pluginSignature = str_replace('_', '', $_EXTKEY) . '_' .    'xlsxtotables'; // from registerPlugin(...)
$TCA['tt_content']['types']['list']['subtypes_addlist']   [$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
    $pluginSignature,    
    'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_xlsxtotables.xml'
); 

我知道XML文件位于正确的位置,但我在TYPO3后端没有任何内容。

有什么建议吗?

2 个答案:

答案 0 :(得分:1)

尝试替换

$pluginSignature = str_replace('_', '', $_EXTKEY) . '_' .    'xlsxtotables';

通过

$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = $extensionName.'_'.'xlsxtotables';

在看到flexform的更改之前,别忘了清空常规缓存。

答案 1 :(得分:1)

您可以在 ext_tables.php 文件

中尝试以下代码
$pluginName = 'Pi1'; // Give Your Plugin Nmae
$pluginSignature = preg_replace('/[^a-z0-9]/', '', strtolower($_EXTKEY)) . '_' . strtolower($pluginName);

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

要在一个或多个前端插件中添加Flexforms,您可以在 \ text_tables.php

中使用以下代码
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$frontendpluginName = 'xxx'; //Your Front-end Plugin Name
$pluginSignature = strtolower($extensionName) . '_'.strtolower($frontendpluginName);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/xyz.xml');