Let's create frontend plugin in your custom TYPO3 extension, Just register frontend plugin and override tt_content.php and setup TYPO3 FlexForm.
Step 1. Overrides tt_content.php
# Create /Configuration/TCA/Overrides/tt_content.php
<?php
if (!defined('TYPO3_MODE')) { die('Access denied.'); }
call_user_func(function () {
# Define extension key
$_EXTKEY = 'extension_key';
# Should move code from ext_tables.php to here > To register plugin
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Pi1',
'Title'
);
# Prepare plugin's signature
$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginName = strtolower('Pi1');
$pluginSignature = $extensionName.'_'.$pluginName;
# Add list_type to tt_content
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
# Add Flexform
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:'.$_EXTKEY . '/Configuration/FlexForms/pi1_name.xml'
);
});
Step 3. Create TYPO3 FlexForm
<!-- /Configuration/FlexForms/pi1_name.xml -->
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Fields</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<headline>
<TCEforms>
<label>Headline</label>
<config>
<type>input</type>
<eval>required</eval>
</config>
</TCEforms>
</headline>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
Post a Comment