Search code examples
typo3typo3-9.xtx-gridelements

Gridelements and flexforms: Access of flexform values by short virtual names


I have a gridelement combined with a flexform for some configuration and can't read the given flexform value by "flexform_fieldname"

System / versions:

  • TYPO3 9.5
  • Gridelements 9.2

Setup Gridelement:

pageStripe {
  frame = 3
  config {
    colCount = 1
    rowCount = 1
    rows {
      1 {
        columns {
          1 {
            name = Title
              colPos = 10
          }
        }
      }
    }
  }
  flexformDS = FILE:EXT:path/to/PageStripe.xml
}

Flexform structure:

<bgcolor type="array">
  <TCEforms>
    <label>Label</label>
    <config>
      <type>select</type>
      <items type="array">
        <numIndex index="0" type="array">
          <numIndex index="0">Default (no background color)</numIndex>
          <numIndex index="1">default</numIndex>
        </numIndex>
      </items>
    </config>
  </TCEforms>
</bgcolor>

Fluid output in my gridelement layout html:

<f:debug>{flexform_bgcolor}</f:debug> // output = NULL
<f:debug>{data.flexform_bgcolor}</f:debug> // output = NULL
<f:debug>{data.pi_flexform.data.general.lDEF.bgcolor.vDEF}</f:debug> // output = correct value

Question: Is this a misconfiguration in my code or a bug in the latest version of gridelements, that flexform values can't be read by the short virtual names (flexform_bgcolor instead of data.pi_flexform.data.general.lDEF.bgcolor.vDEF), even though "resolveFlexFormData" is set to 1?


Solution

  • It's neither a bug nor a misconfiguration, but with dataProcessing enabled you must be within a FLUIDTEMPLATE. So there is no need to provide FlexForm values within virtual fields, since you can access array keys directly from within Fluid, which is not possible from within TypoScript.

    So the "old school" TypoScript static template file that makes use uf userFunc still provides those fields, while the new and recommended static does not.