I am looking for a way to simplify the creation of content elements in TYPO3.
I am following the official documentation: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html
Now, in step 2 we have this daunting beauty:
// Configure the default backend fields for the content element
$GLOBALS['TCA']['tt_content']['types']['yourextensionkey_newcontentelement'] = [
'showitem' => '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;general,
--palette--;;headers,
bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
--palette--;;frames,
--palette--;;appearanceLinks,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;;access,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
categories,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
rowDescription,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
',
'columnsOverrides' => [
'bodytext' => [
'config' => [
'enableRichtext' => true,
'richtextConfiguration' => 'default',
],
],
],
];
It looks to me, as if all that needs to be replaced is 'yourextensionkey_newcontentelement' and the rest comes from the core. Unless you know what you are doing and want to do this differently.
My questions:
- What exactly does this do? (I am aware, it sets up some TCA for the forms of editing the CE.)
- If this is the same for standard cases, can we get the entire array from the core, e.g. by providing a function for that? Would that be a good approach?
- Do you have other ideas for simplifying this?
- Are there methods available to write this human-readable and convert it or with autoexpand (e.g. by PhpStorm plugin)?
I am aware that there is an initiative working on improving how CE are handled longterm. What I am looking for now are things we can do shortterm to simplify CE creation. I am also aware there are extensions like "mask" or "dce" but we don't advertise them in the official docs, we advertise this: Create Custom Content Elements
Disclaimer: I am not an expert on creating content elements in TYPO3. Most of the time I write extensions with plugins or other functionality. This may be a stupid question / suggestion. Just let me know.