TYPO3 - Add flexform to my own extension

白昼怎懂夜的黑 提交于 2019-12-13 02:23:20

问题


I am building my own extension. I have found this page about adding Flexform to the Extension https://gist.github.com/alrnz/c0f00b196d378f5b9150

And in my ext_tables.php i have this:

\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'
); 

I know that the XML-file is in the right place, but I do not get anyting from it in TYPO3 backend.

Any suggestions?


回答1:


Try replace

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

by

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

And dont forget to empty your general cache before you see a change with your flexform.




回答2:


You can try below code in ext_tables.php file

$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'
);

For Adding Flexforms in One or More Front-end plugins you can use Below code in ext_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');


来源:https://stackoverflow.com/questions/28219192/typo3-add-flexform-to-my-own-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!