Created
May 19, 2017 06:12
-
-
Save PSchwalkowski/ff47f5286870e0cdba4f819107a2dbcb to your computer and use it in GitHub Desktop.
TYPO3 FlexForm utility to speed up development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PS\Theme\Utility; | |
/** | |
* Utilities which should help to manage flexforms | |
*/ | |
class FlexForm { | |
/** | |
* Register new flexform | |
* WARNING! It will override existing one if exists | |
* | |
* @param string $extKey extension key | |
* @param string $pluginName name of plugin | |
* @param string $flexFormFile name of flexform file, optional | |
* @return void | |
*/ | |
public static function registerFlexForm($extKey, $pluginName, string $flexFormFile = null) { | |
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extKey); | |
$pluginSignature = implode('_', [strtolower($extensionName), strtolower($pluginName)]); | |
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; | |
if (!$flexFormFile) | |
$flexFormFile = $pluginName; | |
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( | |
$pluginSignature, | |
'FILE:EXT:' . $extKey . '/Configuration/FlexForms/' . $flexFormFile . '.xml' | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment