skip to Main Content

I’m kind of new to typo3, and I’m facing a little problem. My case is simple: I’d like to have, for example, two headers, but the tt_content table only has one header. I don’t want to extend tt_content since I know that this field would probably only be used in a single content element, and I consider this as a wrong move. I don’t want to have millions of columns in my table.

I considered three approaches

Create a field where I will store serialized data with multiple values in. I know that this solution is not great, and it could quickly become a problem. However, I believe that sometimes storing two fields in one column is better than adding this additional field each time I want something new in the CE.

Use a typo3 flexform. Solution similar to point 1, but the structure is defined. Well, I didn’t like that because I can’t overwrite the structure in my content elements themselves, so I would have to declare every configuration in advance. I thought that it would come back to the problem that I’m facing. I would rather have a more dynamic solution that I can reuse, for example, in another plugin without again adding a million fields. Also it contains problems connected with the first solution.

Make my own extension table where I will store only the values that I want connected with the content element that I am designing. It seems to me like the best option, but I don’t know how to then connect the fields from the new table to display them in the content element edit form. The best would be something like an inline field with a 1:1 relation, so there wouldn’t be this accordion like things for multiple elements.

How would you solve this issue?

2

Answers


  1. If you don’t want to extend tt_content.

    Flexform is the standard aproach to provide fields in a serialized format.

    So i would suggest to go with that.

    For each content element type you would have to define a flexform. If you have a lot of repeated fields across content elements this of course means duplications.

    There are extensions like "flux" which generate flexform via hooks. But as you said you are new to TYPO3 best stay with the basics.

    So i suggest to use flexforms as this is the core solution to your problem

    Login or Signup to reply.
  2. In my experience there is nothing wrong with creating additional tt_content columns. It is the best way to go, as flexforms have a negative effect on the rendering speed of the content element. The rule is: only use configuration data in flex forms.

    When I would have to create one special content element with two header fields, I would use another field in tt_content for this special CE.

    If I wanted to extend all headers of all CEs, I would do that in my site_package by extending the tt_content table, its TCA and so on.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search