简体   繁体   中英

TYPO3 TCA add new field via XML

i search for a Solution: How can i add a new Field in a existing XML ?

extname/Configuration/TCA/Overrides/tt_content.php

...
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['ext_name'] = 'pi_flexform'; 
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('ext_name',
'FILE:EXT:extname/Configuration/FlexForms/flexform.xml');
...

And here the XML...

...
<T3DataStructure>
...
</T3DataStructure>
...

I am have a Ext. and now i go in my tt_content.php File and copy this Code in. But now i can overright the Full-File! But i need only one new field, and the original should not change!

Thanks!

The fastest way is for sure to just copy the full file and manipulate it. However sometimes it is nice to avoid that and of course there is a solution for that. It is described in the docs of my news extension at https://docs.typo3.org/typo3cms/drafts/github/georgringer/news/DeveloperManual/ExtendNews/ExtendFlexforms/Index.html#extend-flexforms-with-custom-fields .

It's rather unfortunate but that's the way how FlexForms work since they represent a fully embedded and encapsulated data structure. Thus if you want to add a field, there is no other way than to copy the FlexForm file and change the configuration to use your file.

Some extensions allow for other ways to customize existing fields, eg via an itemsProcFunc for select fields, but obviously the options are very limited here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM