Issue Bug Closed

#105800Flex Form Field is inaccessible after the 13.4.2 update

Tiran Grigoryan 12/10/24, 14:55 updated 12/02/25, 14:37

Description

After the minor update, the Flex Form fields are no longer accessible. It is empty.
This worked under 13.4.1!

In Content Blocks:

fields:
  - identifier: my_flexform
    type: FlexForm
    fields:
      - type: Sheet
        identifier: sheet1
        label: Sheet 1
        fields:
          - identifier: section1
            type: Section
            label: Section 1
            container:
              - identifier: container1
                label: Container 1
                fields:
                  - identifier: container_field
                    type: Text
              - identifier: container2
                label: Container 2
                fields:
                  - identifier: container_field2
                    type: Textarea

Translated to FlexForm XML definition:

<T3FlexForms>
    <sheets type="array">
        <sheet1 type="array">
            <ROOT type="array">
                <type>array</type>
                <el type="array">
                    <field index="section1" type="array">
                        <title>Section 1</title>
                        <type>array</type>
                        <section>1</section>
                        <el type="array">
                            <field index="container1" type="array">
                                <title>Container 1</title>
                                <type>array</type>
                                <el type="array">
                                    <field index="container_field" type="array">
                                        <label>container_field</label>
                                        <config type="array">
                                            <type>input</type>
                                        </config>
                                    </field>
                                </el>
                            </field>
                            <field index="container2" type="array">
                                <title>Container 2</title>
                                <type>array</type>
                                <el type="array">
                                    <field index="container_field2" type="array">
                                        <label>container_field2</label>
                                        <config type="array">
                                            <type>text</type>
                                        </config>
                                    </field>
                                </el>
                            </field>
                        </el>
                    </field>
                </el>
            </ROOT>
        </sheet1>
    </sheets>
</T3FlexForms>

Bildschirmfoto%202024-12-10%20um%2014.54.38.png

Reviews 3

Files 6

History 1421

  1. Oliver Bartsch commented and changed status New Needs Feedback Complexity easy <span data-processor="relativetime" data-value="2024-12-10T15:20:00+00:00" > 12/10/24, 15:20 </span>

    Hi, thanks for your report.

    Could you please share your template, so I can see which variable is accessed in the frontend.

    Best, Oli

  2. Nikita Hovratov changed description status Needs Feedback New Complexity easy <span data-processor="relativetime" data-value="2024-12-10T15:22:27+00:00" > 12/10/24, 15:22 </span>

  3. Tiran Grigoryan commented and changed attached Bildschirmfoto 2024-12-10 um 17.00.42.png attached Bildschirmfoto 2024-12-10 um 17.01.48.png <span data-processor="relativetime" data-value="2024-12-10T16:04:33+00:00" > 12/10/24, 16:04 </span>

    Oliver Bartsch wrote in #note-2:
    > Hi, thanks for your report.
    >
    > Could you please share your template, so I can see which variable is accessed in the frontend.
    >
    > Best, Oli

    *Another example
    *

    <f:debug>{_all}</f:debug>

    Typo3 13.4.1
    Bildschirmfoto%202024-12-10%20um%2017.00.42.png

    And after Typo3 13.4.2

    composer update

    Bildschirmfoto%202024-12-10%20um%2017.01.48.png

    empty property

  4. Nikita Hovratov commented and changed status Needs Feedback Accepted <span data-processor="relativetime" data-value="2024-12-10T17:22:23+00:00" > 12/10/24, 17:22 </span>

    Could you also share please your TCA, where you’ve defined the FlexForm field?
    You probably used the “default” key, that’s why the transformed FlexForm array was just passed through, without further processing.
    As a workaround, you could switch to FlexFormProcessor in your TypoScript, which will essentially bring back your old behavior.
    In the meantine we will work on a proper solution, so that we have a real schema for Sections.

  5. Tiran Grigoryan commented <span data-processor="relativetime" data-value="2024-12-10T17:30:08+00:00" > 12/10/24, 17:30 </span>

    Oliver Bartsch wrote in #note-2:
    > Hi, thanks for your report.
    >
    > Could you please share your template, so I can see which variable is accessed in the frontend.
    >
    > Best, Oli

    I was able to find where the error lies
    In the

    FlexFormSchemaFactory->getSchemaForRecord

    in v13.4.1 it always returned null for FlexForm -> Sections and Container.
    As soon as I changed the

    RecordFieldTransformer->processFlexForm

    debug line 246

    $fieldInformationOfFlexField = $usedSchema->getField($fieldName);

    it always returned null, because the usedSchema has no field, but section and container.

    Therefore I have a solution:

    .....
    226: if ($usedSchema !== null) {
                $resolvedValues = [];
                // Flatten keys (because we receive settings[mysetting] and we want settings.mysetting)
                $flattenPlainValues = ArrayUtility::flattenPlain($plainValues);
                $recordFactory = GeneralUtility::makeInstance(RecordFactory::class);
                foreach ($flattenPlainValues as $fieldName => $plainFieldValue) {
                    // That's a "fun" workaround: In order to allow to process e.g. "sDEF/header", we need
                    // to add this to the "rawRecord" (thus, we clone it), so it is within the array
                    // and then set "sDEF/header" even though this is not a DB field. Then we keep it in "$fieldName"
                    // which actually is the plain field name (in this case "header")
    
                    $fieldInformationOfFlexField = $usedSchema->getField($fieldName);
    
                    // No field given, we just skip the value, as it is not properly defined
                    if ($fieldInformationOfFlexField === null) {
                        continue;
                    }
                    $rawRecordValues = array_replace($record->toArray(), [$fieldInformationOfFlexField->getName() => $plainFieldValue]);
                    $fakeRawRecordWithFlexField = $recordFactory->createRawRecord($record->getMainType(), $rawRecordValues);
                    $transformedValue = $this->transformField($fieldInformationOfFlexField, $fakeRawRecordWithFlexField, $context, $recordIdentityMap);
                    $resolvedValues[$fieldName] = $transformedValue;
                }
                if (!empty($resolvedValues)) {
                    return new FlexFormFieldValues(ArrayUtility::unflatten($resolvedValues));
                }
            }
    .....
  6. Tiran Grigoryan commented and changed attached Bildschirmfoto 2024-12-10 um 18.39.43.png <span data-processor="relativetime" data-value="2024-12-10T17:40:02+00:00" > 12/10/24, 17:40 </span>

    Tiran Grigoryan wrote in #note-8:
    > Oliver Bartsch wrote in #note-2:
    > > Hi, thanks for your report.
    > >
    > > Could you please share your template, so I can see which variable is accessed in the frontend.
    > >
    > > Best, Oli
    >
    > I was able to find where the error lies
    > In the
    > […]
    > in v13.4.1 it always returned null for FlexForm -> Sections and Container.
    > As soon as I changed the
    > […]
    > debug line 246
    > […]
    > it always returned null, because the usedSchema has no field, but section and container.
    >
    > Therefore I have a solution:
    > […]

    Bildschirmfoto%202024-12-10%20um%2018.39.43.png

  7. Tiran Grigoryan commented and changed attached typo3-cms-core-flex.patch <span data-processor="relativetime" data-value="2024-12-11T07:44:59+00:00" > 12/11/24, 07:44 </span>

    Tiran Grigoryan wrote in #note-9:
    > Tiran Grigoryan wrote in #note-8:
    > > Oliver Bartsch wrote in #note-2:
    > > > Hi, thanks for your report.
    > > >
    > > > Could you please share your template, so I can see which variable is accessed in the frontend.
    > > >
    > > > Best, Oli
    > >
    > > I was able to find where the error lies
    > > In the
    > > […]
    > > in v13.4.1 it always returned null for FlexForm -> Sections and Container.
    > > As soon as I changed the
    > > […]
    > > debug line 246
    > > […]
    > > it always returned null, because the usedSchema has no field, but section and container.
    > >
    > > Therefore I have a solution:
    > > […]
    >
    > Bildschirmfoto%202024-12-10%20um%2018.39.43.png

  8. Gerrit Code Review pushed patch set 1 for main to change 87431 status Accepted Under Review <span data-processor="relativetime" data-value="2024-12-11T10:09:03+00:00" > 12/11/24, 10:09 </span>

  9. Oliver Hader commented and changed Is Regression 1 <span data-processor="relativetime" data-value="2025-01-20T08:23:59+00:00" > 01/20/25, 08:23 </span>

    I guess the new behavior (with 13.4.2) is related to the change for #105621

  10. Dennis Purisevic commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-04-28T20:05:07+00:00" > 04/28/25, 20:05 </span>

    Applied in changeset commit:95a53fb2873e355cb0ffbe2953e5ddaaf15a667d.