typo3fluidflexform

Typo3 Custom Element with Flexform: How do I write value to tt_content header?


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.


Solution

  • 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>