Review main Abandoned

92923[FEATURE] Enable condition-based configuration of fields as required

Bastien Lutz CR 0 V 0 Nightmare +4978 −812 updated 03/16/26, 13:04

Commit message

Sometimes fields are required based on conditions, e.g. based on other
field values. To prevent broken records in the database, the TCA must
provide a possibility to configure this type of dependency. This is
done with the new field configuration option `requiredCond`.

The same matrix as for `displayCond` is used here.

Review

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

Issues 2

Files 9

Review log 2533

Show 68 earlier messages
  1. Bastien Lutz uploaded patch set 1 02/20/26, 13:24

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

  3. Bastien Lutz uploaded patch set 2 V -1 02/20/26, 14:57

  4. core-ci voted on patch set 2 V +1 02/20/26, 15:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96364

  5. Andreas Nedbal voted on patch set 2 CR +1 V +1 02/23/26, 11:17

  6. Oli Bartsch commented on patch set 2 02/23/26, 14:00

    Could you please have a look at the commit message. it seems that there are a couple of words missing, as well as line length limit.
  7. Bastien Lutz updated the commit message in patch set 3 CR +1 V +1 02/23/26, 14:45

  8. Bastien Lutz commented on patch set 3 02/23/26, 14:46

    Reply

    Done
  1. core-ci voted on patch set 3 V +1 02/23/26, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96587

  2. Oli Bartsch commented on patch set 3 V -1 02/23/26, 17:55

    This now prevents to switch form the default "0" mode to any other mode. After confirmation of the "needs reload" modal, the previous state is restored.

    EvaluateRequiredConditions.php:65

    Based on the comment `not marked`, shouldn't this be `!$conditionResult`, or is the comment wrong?

    Feature-108937-EnableConfiguringFieldAsRequiredDependendingOnOtherFieldsInTCA.rst:14

    This sounds really generic. Please let's avoid to start this way for features. Just tell what is introduced, and then a why can be added. Otherwise one might argue that this is not a feature but a bugfix.

    Feature-108937-EnableConfiguringFieldAsRequiredDependendingOnOtherFieldsInTCA.rst:25

    Still we might mention some or at least add a link to the documentation.
  3. Benni Mack commented on patch set 3 02/24/26, 07:54

    I recently built this a different way than the ugly displayCond syntax (not for required though) ... I used symfony expression builder for this which is really really easy to use (and more wide-spread): $expressionLanguage = new ExpressionLanguage(); if ($expressionLanguage->evaluate($condition, $recordDataOrData)) { then you can do requiredIf => "field('pid') > 123" etc. in a more understandable way
  4. Bastien Lutz commented on patch set 3 02/24/26, 09:12

    Reply

    this is also a nice approach. But i thought, as there already is a condition metric in the TCA we should just stick to it. Might make life easier to have one syntax for the whole TCA topic.
  5. Oli Bartsch commented on patch set 3 02/24/26, 09:22

    Reply

    What about using the current approach for v14 and migrate the now centralized `TcaConditionService` functionality to expression language in v15?
  6. Bastien Lutz commented on patch set 3 02/24/26, 14:59

    Reply

    after some debugging this was due to a regression through: https://review.typo3.org/c/Packages/TYPO3.CMS/+/92910 but will be fixed with https://review.typo3.org/c/Packages/TYPO3.CMS/+/92983 i'll add this as a relation chain.
  7. Bastien Lutz uploaded patch set 4 V +1 02/24/26, 15:54

  8. Bastien Lutz uploaded patch set 5 02/24/26, 16:03

  9. Bastien Lutz commented on patch set 4 02/24/26, 16:03

    EvaluateRequiredConditions.php:65 Reply

    This was due to a copy & paste error from EvaluateDisplayConditions it should always be added if the type is flex.

    Feature-108937-EnableConfiguringFieldAsRequiredDependendingOnOtherFieldsInTCA.rst:14 Reply

    Done

    Feature-108937-EnableConfiguringFieldAsRequiredDependendingOnOtherFieldsInTCA.rst:25 Reply

    Done
  10. core-ci voted on patch set 4 V +1 02/24/26, 16:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96763

  11. core-ci voted on patch set 5 V +1 02/24/26, 16:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96764

  12. Simon Schaufelberger commented on patch set 5 02/24/26, 17:54

    EvaluateDisplayConditions.php:30

    can be readonly

    EvaluateRequiredConditions.php:30

    can be readonly

    EvaluateRequiredConditions.php:40

    this annotation is not helpful

    EvaluateRequiredConditions.php:86

    i really don't like deep nesting. can we have a negated condition here and use continue?

    TcaConditionService.php:222

    use return here directly.

    TcaConditionService.php:656

    use return here directly and everywhere below
  13. Bastien Lutz rebased onto patch set 6 V +1 02/25/26, 09:10

  14. core-ci voted on patch set 6 V +1 02/25/26, 09:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96804

  15. Bastien Lutz uploaded patch set 7 V +1 02/25/26, 09:34

  16. Bastien Lutz commented on patch set 7 02/25/26, 09:35

    Thanks for the review. Done.

    EvaluateDisplayConditions.php:30 Reply

    Done

    EvaluateRequiredConditions.php:30 Reply

    Done

    EvaluateRequiredConditions.php:40 Reply

    Done

    EvaluateRequiredConditions.php:86 Reply

    Done

    TcaConditionService.php:222 Reply

    Done

    TcaConditionService.php:656 Reply

    Done
  17. core-ci voted on patch set 7 V +1 02/25/26, 10:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96805

  18. Simon Schaufelberger commented on patch set 7 CR +1 02/25/26, 10:30

    Much better!
  19. Simon Schaufelberger commented on patch set 7 CR 0 02/25/26, 10:35

    TcaConditionService.php:137

    this one could be negated as well
  20. Benni Mack commented on patch set 7 02/25/26, 11:31

    Reply

    We still haven't defined then what to do with the places in DataHandler then? We could then rename the property to "displayRequiredCond" :) - "requiredCond" (= and evaluation in persistence makes it much harder). In case we don't have any more use-cases --- right now --- we could also stick to a custom render Type for this single-use case now.
  21. Bastien Lutz commented on patch set 7 02/25/26, 13:38

    Reply Unresolved

    This patch is currently working without touching the DataHandler. Am i missing something? Should something be adjusted in the DataHandler? If so we might switch to symfony expression language if not i don't think this is necessary.
  22. Bastien Lutz uploaded patch set 8 V +1 02/25/26, 13:44

  23. core-ci voted on patch set 8 V +1 02/25/26, 13:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96824

  24. Bastien Lutz commented on patch set 8 02/25/26, 13:59

    TcaConditionService.php:137 Reply

    Done
  25. Bastien Lutz abandoned the change 03/16/26, 13:04

    It is unclear how this is treated in the Datahandler. For instance there only is one usecase. This is done in: 93021: [TASK] Mark shortcut as required if shortcut_mode=0 | https://review.typo3.org/c/Packages/TYPO3.CMS/+/93021