Reputation: 1
I'm currently working on a custom content element with custom fields in Typo3 (Version 8.7).
My question is if it's possible (and/or reasonable) to create a content element with a list of custom fields based on a single column in the tt_content table containing all the data in form of a serialized array?
I thought about this as an alternative for extending tt_content with a lot of columns. I already tried it with the pre- and postprocessFieldArray hooks, but I didn't yet find a working solution.
Upvotes: 0
Views: 317
Reputation: 10791
This concept already is used from some extensions to define new CEs (TemplaVoila, gridelements, fluidcontent, dce, ...). So they do not use serialized data but XML.
Even the core does use it since ever:
for plugins (field Ctype
= 'list') there is an option to store configuration in the field pi_flexform
.
depending on the kind of extension the handling does differ a little bit. you can find code examples on this page (german).
Look at the XML definition files which use a syntax similar to TCA and which enable the core to build proper forms to fill.
and now: why you should not do it:
Flexforms have some drawbacks which will catch you in some time.
I don't think that serialized data, JSon or similar in a text field can be handled much better. Serialized may be worse, as a simple edit, which can be done in XML easily, might invalidate your data.
Each such attempt of compressed data waste the space of the fields already existing and which you will not free: have a look how many fields are available in the tt_content records.
If you want a good extension for your own CEs (Content Elements) you may evaluate EXT:mask
(as a kickstarter) and EXT:mask_export
which enables you to recycle all these fields for your own purpose and generate new simple fields.
Upvotes: 1