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. Nikita Hovratov changed Complexity easy 12/10/24, 15:14

  2. Oliver Bartsch commented and changed status New Needs Feedback Complexity easy 12/10/24, 15:20

    Hi, thanks for your report.

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

    Best, Oli

  3. Nikita Hovratov changed description status Needs Feedback New Complexity easy 12/10/24, 15:22

  4. Garvin Hicking changed status New Needs Feedback 12/10/24, 15:32

  5. Nikita Hovratov changed Is Regression 1 12/10/24, 15:58

  6. 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 12/10/24, 16:04

    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

  7. Nikita Hovratov commented and changed status Needs Feedback Accepted 12/10/24, 17:22

    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.

  8. Tiran Grigoryan commented 12/10/24, 17:30

    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));
                }
            }
    .....
  9. Tiran Grigoryan commented and changed attached Bildschirmfoto 2024-12-10 um 18.39.43.png 12/10/24, 17:40

    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

  10. Tiran Grigoryan commented and changed attached typo3-cms-core-flex.patch 12/11/24, 07:44

    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

  11. Gerrit Code Review pushed patch set 1 for main to change 87431 status Accepted Under Review 12/11/24, 10:09

  12. Oliver Hader changed Related to #105621 01/20/25, 08:23

  13. Oliver Hader commented and changed Is Regression 1 01/20/25, 08:23

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

  14. Gerrit Code Review pushed patch set 1 for main to change 89096 04/13/25, 12:48

  15. Gerrit Code Review pushed patch set 2 for main to change 89096 04/28/25, 12:15

  16. Gerrit Code Review pushed patch set 3 for main to change 89096 04/28/25, 12:30

  17. Gerrit Code Review pushed patch set 4 for main to change 89096 04/28/25, 13:19

  18. Gerrit Code Review pushed patch set 5 for main to change 89096 04/28/25, 14:12

  19. Gerrit Code Review pushed patch set 1 for 13.4 to change 89263 04/28/25, 20:01

  20. Dennis Purisevic commented and changed status Under Review Resolved done 0 % 100 % 04/28/25, 20:05

    Applied in changeset commit:95a53fb2873e355cb0ffbe2953e5ddaaf15a667d.

  21. Benni Mack changed status Resolved Closed 12/02/25, 14:37