Review main Work in progress Orphaned

83728[WIP][BUGFIX] Merge PageTSConfig to flexform field 'config' in FormEngine

Stefan Bürk CR 0 V 0 Hard +267 −0 updated 01/21/25, 14:21

Commit message

The backend FormEngine allows to override TCA configuration
(the `config` array) using Page TSconfig when rendering fields.

Sadly, overriding flexform configuration from Page TSconfig only
worked for field labels, but not for the field `config` itself.

This was documented since very early TYPO3 versions, but did
not work until this patch. For the time being, the documentation
has already been adjusted to no longer list this behaviour
as valid configuration.

Documented behavior was to use a syntax like:

```
TCEFORM.tt_content.pi_flexform.felogin_login.sDEF {
  settings\.showForgotPassword {
    config {
      readOnly = true
    }
  }
}
```

With this patch, that Page TSconfig needs to slightly
look different:

```
TCEFORM.tt_content.pi_flexform.types.felogin_login.sDEF {
  settings\.showForgotPassword {
    config {
      readOnly = true
    }
  }
}
```

Only a very restricted list of keys in the `config` array
can be overridden by Page TSconfig (listed in
`FormEngineUtility::$allowOverrideMatrix`), because it
could negatively impact the DataHandler. Page TSconfig
is not applied there, and TCA mismatches could affect
actual data storage.

This change modifies `FlexFormElementContainer` to merge
the `PageTsConfig` with field configuration for the faked
parameters array, used to render the markup.

Tests are added to ensure that the applied TSconfig
yields the expected markup, and no disallowed changes
are applied to `config`.

Internal / Todo:
----------------

*   The `.types.` syntax may be subject to change in further revisions
    of this WIP patch. If the new syntax is kept, the documentation
    will be adjusted to contain this, and this patch will need
    an "important.rst" addition.
*   Consider to have a dedicated `AllowList` for flexform,
    add 3rd argument to select the the allow list (or a
    dedicated method).

Some remarks:
-------------

*   Field label override is handled by the form data provider
    `TcaColumnsProcessFieldLabels`
*   The data provider chain contains temporary merging for
    the dataprovider chain, not reflected down to the render
    nodes.
*   Selected form container provides the PageTsConfig override
    for the rendering of the form.
*   The following code already worked for adjusting the `label`
    with a Page TSconfig override. Note the absence of `types.`
    here:

```
TCEFORM.tt_content.pi_flexform.felogin_login.sDEF {
  settings\.showForgotPassword {
    label = TESTLABEL
  }
}
TCEFORM.tt_content.pi_flexform.types.felogin_login.sDEF {
  settings\.showForgotPassword {
    config {
      readOnly = true
    }
  }
}
```

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 9
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/28/83728/9 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/28/83728/9 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 2

Issues 4

Files 2

Review log 1119

  1. Stefan Bürk uploaded patch set 1 04/10/24, 11:02

  2. Stefan Bürk updated the commit message in patch set 2 04/10/24, 11:07

  3. core-ci voted on patch set 1 V +1 04/10/24, 11:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55675

  4. core-ci voted on patch set 2 V +1 04/10/24, 11:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55676

  5. Stefan Bürk updated the commit message in patch set 3 V +1 04/10/24, 11:15

  6. Stefan Bürk updated the commit message in patch set 4 04/10/24, 11:18

  7. core-ci voted on patch set 3 V +1 04/10/24, 11:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55677

  8. core-ci voted on patch set 4 V +1 04/10/24, 11:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55679

  9. Garvin Hicking uploaded patch set 5 V +1 04/11/24, 12:12

    Add test
  10. core-ci voted on patch set 5 V +1 04/11/24, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55770

  11. Garvin Hicking commented on patch set 5 CR +1 V +1 04/11/24, 12:19

    I tested this with a few overrides, and added the automatic tests for it. It seems to work well for me, but to be honest I can't comment much on possible side-effects it could have, that I haven't tested. The one thing that would make this patch a bit more "user friendly" is that if we could make this ".types." subkey part not mandatory, so that the code would then work as it was previously documented. Thanks so much for digging into this and working together with me, this gave me a lot of insight.
  12. Benni Mack updated the commit message in patch set 6 CR +1 V +1 10/18/24, 13:26

  13. core-ci voted on patch set 6 V -1 10/18/24, 17:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67965

  14. Benni Mack rebased onto patch set 7 V -1 10/18/24, 17:57

  15. Garvin Hicking updated the commit message in patch set 8 01/21/25, 13:03

  16. core-ci voted on patch set 8 V -1 01/21/25, 13:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72783

  17. Benni Mack marked it work in progress 01/21/25, 14:05

  18. Garvin Hicking uploaded patch set 9 V -1 01/21/25, 14:15

  19. core-ci voted on patch set 9 V +1 01/21/25, 14:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72789