Skip to content

Instantly share code, notes, and snippets.

@fchaussin
Last active September 27, 2019 14:04
Show Gist options
  • Save fchaussin/c20ca4b77003a382587d523399ae72b2 to your computer and use it in GitHub Desktop.
Save fchaussin/c20ca4b77003a382587d523399ae72b2 to your computer and use it in GitHub Desktop.
TYPO3 : adding a FlexForm to an Extbase Extension
<?php
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function()
{
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(...
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(...
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(....
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages(...
}
);
////////////////////////////////////////////////////////////////////////////////////////////////
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_my_plugin_namet';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY.'/Configuration/FlexForms/my_plugin_name.xml');
<T3DataStructure>
<sheets>
<page1>
<ROOT>
<TCEforms>
<sheetTitle>Page 1</sheetTitle>
</TCEforms>
<type>array</type>
<el>
...
</el>
</ROOT>
</page1>
<page2>
...
</page2>
</sheets>
</T3DataStructure>
class MyController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
...
private function _getFlexFormOptions()
{
$this->contentObj = $this->configurationManager->getContentObject();
$piFlexForm = $this->contentObj->data['pi_flexform'];
$options = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($piFlexForm);
return $options;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment