0
votes

I am writing a Typo3 extension with custom content elements using Flexforms. All is working fine. I just would like to add a value to "header" inside of tt_content just like the standard Typo3 content elements do. That way, if I create a translation, the default header of the translated content should show as "My headline (copy 1)" and not just as "(copy 1)". Also, the header should show up if I try and add an anchor link to the element.

For example, my flexform starts like this:

<T3DataStructure>
  <sheets>
    <sGeneral>
    <ROOT>              
      <TCEforms>
        <sheetTitle>My Element</sheetTitle>
      </TCEforms>               
      <type>array</type>
      <el>
        <headline>
          <TCEforms>
            <label>Text</label>
            <config>
               <type>input</type>                                               
            </config>
          </TCEforms>
        </headline>
        ...

I access above headline value in my HTML template like this: {flexform.sGeneral.headline}

That works well. How can I accomplish that this value also gets written to tt_content header?

I really appreciate your help.

1
Short answer: you can't. A flexform stores the values of all your flexform fields in a single database table attribute. Whereas the standard header field has a table attribute of it's own. What you can do, is to enable and show the header field for your content element. This is done via TCA. You should have a file like Configuration/TCA/Overrides/tt_content.php which defines what fields are available for your content element. One of them should be your flexform attribute (which shows multiple fields). There you have to enable and show the header field, too - Stefanos Karasavvidis
Thank you very much for your helpful reply. Yes, I do have a tt_content TCA override file. Can I only set a static value for the header there or can I somehow reference the value inside the flexform? - Port Islander 2009

1 Answers

0
votes

The flexform (and all fields declared inside) are one field of the whole tt_content record. So there is a big difference whether you access a flexform field data or a data from any regular field in the record. You can't mix it up. (A field header in your flexform has no relation to the regular field header of the record)

For giving editors access to the regular header field you need to declare access for your type of tt_content (CType). This is done in the TCA-declaration.

Anyway you should have access to the header field from your FLUID as you have access to the whole tt_content record. normaly as {data.fieldname}, you might inspect with the debugger:
<f:debug title="all fluid variables">{_all}</f:debug>