Review main Merged

93145[TASK] Add TCA and schema as state to FormEngine $result

Bastien Lutz CR +2 V +2 Expert +1506 −942 updated 03/24/26, 12:22

Commit message

The rewrite of FormEngine in TYPO3 v7/v8 designed the code
to allow rendering of "anything that looks like TCA". This
is where the separation of 'data providing' and 'rendering'
stems from.

This strategy worked out: Nowadays, we're using FormEngine
to prepare data in various places and use it with custom
rendering, and we use FormEngine (for instance is the site
module) to prepare and render "fake TCA".

There are a couple of glitches, though. The patch aims to
resolve one of them: Preparing and rendering "something
that looks like TCA but isn't $GLOBALS['TCA']" isn't truly
possible since various areas of the FormEngine data preparation
and the render part still access $GLOBALS['TCA'] directly.
Together with the TYPO3 v13 works regarding TcaSchema, this
should be solved now.

FormEngine is built around a central state array, it is
called $result within the data preparation, and $this->data
in the render part. The patch adds TCA and TCA Schema to
this array. Consuming code can switch from accessing
$GLOBALS['TCA'] to these array keys instead. This allows
controllers to actively provide this state if they deal
with "fake" TCA. SiteConfigurationController show cases
this quite well.

To attach the TcaSchema, the patch splits TcaSchemaFactory
into an additional builder class that can be used with
"any" TCA lookalive. This streamlines the factory scope
as well, TcaSchemaFactory is now an injectable service to
retrieve an object representation of globals TCA built
during bootstrap, while TcaSchemaBuilder is a stateless
service to build the object structure (a SchemaCollection)
and returns it. TcaSchemaBuilder is declared @internal for
now.

With the patch, FormEngine worker code no longer uses
$GLOBALS['TCA'] directly anymore - there is only one
fallback (or default) in a very early data provider in
case controllers didn't provide it.

Note: If we find a good solution to substitute $result
key 'processedTca' with something based on the TcaSchema
object structure, $result key 'tca' may become obsolete later.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 64

Show 44 more files

Review log 3453

Show 1728 earlier messages
  1. Bastien Lutz uploaded patch set 1 03/10/26, 14:22

  2. Bastien Lutz marked it work in progress 03/10/26, 14:22

  3. Bastien Lutz rebased onto patch set 2 03/10/26, 14:22

    The following files contain Git conflicts: * typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php * typo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.php * typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/SiteDatabaseEditRowTest.php
  4. core-ci voted on patch set 1 V -1 03/10/26, 14:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97703

  5. core-ci voted on patch set 2 V -1 03/10/26, 14:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97704

  6. Bastien Lutz uploaded patch set 3 V -1 03/11/26, 09:06

  7. core-ci voted on patch set 3 V -1 03/11/26, 09:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97742

  8. Bastien Lutz uploaded patch set 4 V -1 03/11/26, 10:38

  9. core-ci voted on patch set 4 V -1 03/11/26, 10:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97746

  10. Bastien Lutz uploaded patch set 5 V -1 03/11/26, 13:36

  11. core-ci voted on patch set 5 V -1 03/11/26, 14:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97761

  12. Bastien Lutz uploaded patch set 6 V -1 03/11/26, 15:59

  13. core-ci voted on patch set 6 V -1 03/11/26, 16:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97767

  14. Bastien Lutz uploaded patch set 7 V -1 03/12/26, 17:14

  15. core-ci voted on patch set 7 V -1 03/12/26, 17:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97842

  16. Bastien Lutz uploaded patch set 8 V -1 03/13/26, 12:12

  17. core-ci voted on patch set 8 V +1 03/13/26, 12:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97887

  18. Bastien Lutz marked it ready for review 03/13/26, 12:40

  19. Christian Kuhn uploaded patch set 9 V +1 03/17/26, 09:37

  20. core-ci voted on patch set 9 V +1 03/17/26, 09:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98081

  21. Benni Mack commented on patch set 9 03/17/26, 13:13

    TcaSchemaFactory.php:144

    please mark this method internal
  22. Christian Kuhn commented on patch set 9 03/17/26, 14:20

    TcaSchemaFactory.php:144 Reply

    we'll change this slightly: TcaSchemaFactory does 3 things currently: * it's goal is to be a statefull, injectable object representation of TCA, built during bootstrap. * it provides get() and has() for single schema * it contains the building to make this re-usable with 'fake tca' (like site settings), we'll do: * this->schemata in TcaSchemaFactory will be turned into an instance of SchemaCollection directly, not the array anymore. * move the worker code of get() and has() into SchemaCollection, both within TcaSchemaFactory will then just call $this->schemata->get()/has(). This gives us a short-hand within SchemaCollection, making it better usable * move build() out of TcaSchemaFactory into a new stateless TcaSchemaBuilder that receives 'the tca array' and returns SchemaCollection. * keep the cache stuff within TcaSchemaFactory this gives us: * TcaSchemaFactory is then clearly only an injectable object represention of globals-tca. no more, no less. * A seperate builder class that builds a collection from anything that 'looks like' TCA * A SchemaCollection that is quite easy to use. * A clear separation of concerns. it allows us to: * build tca schema easily from anything that 'looks like tca' and has no direct dependency to globals-tca. this state can then be hand around (for instance in formEngine). We then don't need buildWithoutCache().
  23. Bastien Lutz uploaded patch set 10 V +1 03/17/26, 15:44

  24. core-ci voted on patch set 10 V -1 03/17/26, 16:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98101

  25. Bastien Lutz uploaded patch set 11 V -1 03/18/26, 09:23

  26. core-ci voted on patch set 11 V -1 03/18/26, 09:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98154

  27. Nikita Hovratov commented on patch set 11 03/18/26, 09:53

    TcaSchemaFactory.php:144 Reply

    I like this, it would also solve an issue in Content Blocks, where I had to create a "simple" TcaSchema, to only create a Schema out of base TCA, without overrides. With that I could drop a lot of code.
  28. Bastien Lutz uploaded patch set 12 V -1 03/18/26, 11:06

  1. Bastien Lutz uploaded patch set 13 03/18/26, 11:06

  2. core-ci voted on patch set 12 V -1 03/18/26, 11:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98164

  3. core-ci voted on patch set 13 V -1 03/18/26, 11:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98165

  4. Bastien Lutz uploaded patch set 14 V -1 03/18/26, 11:59

  5. core-ci voted on patch set 14 V +1 03/18/26, 12:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98171

  6. Christian Kuhn uploaded patch set 15 V +1 03/18/26, 16:44

  7. core-ci voted on patch set 15 V -1 03/18/26, 16:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98209

  8. Benni Mack commented on patch set 15 03/18/26, 16:57

    AbstractItemProvider.php:1272

    the fields are now not prepended with "table.uid". That might become a problem.

    DatabaseDefaultLanguagePageRow.php:44

    let's please use the LanguageCapability
  9. Christian Kuhn uploaded patch set 16 V -1 03/18/26, 16:59

  10. core-ci voted on patch set 16 V -1 03/18/26, 17:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98210

  11. core-ci voted on patch set 16 V +1 03/18/26, 17:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98210

  12. Bastien Lutz uploaded patch set 17 V +1 03/19/26, 07:54

  13. Bastien Lutz commented on patch set 16 03/19/26, 07:54

    AbstractItemProvider.php:1272 Reply

    already resolved, as schema is not nullable anymore.

    DatabaseDefaultLanguagePageRow.php:44 Reply

    Done
  14. core-ci voted on patch set 17 V +1 03/19/26, 08:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98225

  15. Christian Kuhn voted on patch set 17 CR +1 V +1 03/21/26, 12:30

  16. Oliver Klee voted on patch set 17 V +1 03/21/26, 12:32

  17. Christian Kuhn uploaded patch set 18 CR +1 V +1 03/21/26, 13:26

  18. Christian Kuhn voted on patch set 18 CR +1 V +1 03/21/26, 13:26

  19. core-ci voted on patch set 18 V +1 03/21/26, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98347

  20. Oliver Klee voted on patch set 18 V +1 03/21/26, 15:44

  21. Georg Ringer voted on patch set 18 CR +2 V +2 03/21/26, 22:24

  22. Georg Ringer merged patch set 19 03/21/26, 22:24

  23. Georg Ringer commented on patch set 19 03/22/26, 20:29

    -1 post review, regression https://forge.typo3.org/issues/109315
  24. Christian Kuhn commented on patch set 19 03/24/26, 12:21

    we missed a resolves line here :/
  25. Christian Kuhn commented on patch set 19 03/24/26, 12:22

    Reply

    Done