Review main Abandoned

73172[FEATURE] Add option to limit the suggest wizard to the current language

Lina Wolf CR -2 V 0 Normal +183 −6 updated 11/05/25, 13:29

Commit message

Introduce a new marker to the `addWhere` property of the TCA suggest
options of the `type=group` field with a notation like
`###REC_FIELD_xxx###` (for example (`###REC_FIELD_sys_language_uid###`).

This placeholder is replaced with the value of the corresponding column
value of the current record ("parent").

This allows to limit the displayed options ("children") of the suggest
wizard by constraining them to specific properties of their parent
record.

Review

  • Code review CR -2
    • Stefan Bürk -2
    • Stefan Froemken +1
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 4

Review log 5785

Show 3960 earlier messages
  1. Lina Wolf uploaded patch set 1 01/25/22, 14:42

  2. core-ci voted on patch set 1 V -1 01/25/22, 14:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22523

  3. Lina Wolf uploaded patch set 2 01/25/22, 14:50

  4. core-ci voted on patch set 2 V -1 01/25/22, 14:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22524

  5. Lina Wolf uploaded patch set 3 01/25/22, 14:53

  6. core-ci voted on patch set 3 V -1 01/25/22, 14:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22525

  7. Lina Wolf uploaded patch set 4 01/25/22, 14:58

  8. core-ci voted on patch set 4 V -1 01/25/22, 15:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22526

  9. Benni Mack commented on patch set 4 01/25/22, 15:22

    SuggestWizardController.php:139

    I'd recommend to check out AbstractItemProvider where ###REC_FIELD_* can be used for any kind of field. That would open up a lot of possibilities, I guess?
  10. Lina Wolf commented on patch set 4 01/27/22, 13:26

    SuggestWizardController.php:139 Reply

    That would be great, however the group field doesn't use a dataprovider (yet?) and anyhow we are in the Ajax request of the suggest wizard here. At least I was not able to get the current site data as the Site attached to the Request is a NullSite.
  11. Lina Wolf uploaded patch set 5 11/03/22, 18:30

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

  13. Lina Wolf rebased onto patch set 6 11/03/22, 19:01

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

  15. Stefan Bürk uploaded patch set 7 11/03/22, 19:35

  16. core-ci voted on patch set 7 V +1 11/03/22, 19:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33076

  17. Stefan Bürk rebased onto patch set 8 11/03/22, 22:56

  18. core-ci voted on patch set 8 V +1 11/03/22, 23:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33087

  19. Georg Ringer commented on patch set 8 CR -1 11/04/22, 09:09

    not all records are t

    SuggestWizardController.php:138

    not all records are translateable and not all records might check and use the field ctrl|languageField for the label
  20. Benni Mack wrote 11/30/22, 09:18

    Removed cc Benni Mack.
  21. Benni Mack commented on patch set 9 CR -1 V +1 12/06/22, 10:51

    Published edit on patch set 8.
  22. core-ci voted on patch set 9 V +1 12/06/22, 11:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34712

  23. Simon Schaufelberger commented on patch set 9 12/08/22, 08:15

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:17

    For example...

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:26

    please use consistent short array notation.

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:45

    this sentence is really hard to understand.
  24. Simon Schaufelberger commented on patch set 9 08/24/23, 15:05

    Does somebody want to update this patch?
  25. Lina Wolf uploaded patch set 10 V +1 06/22/24, 11:05

  26. Lina Wolf commented on patch set 10 06/22/24, 11:06

    SuggestWizardController.php:138 Reply

    Done

    SuggestWizardController.php:139 Reply

    Done

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:17 Reply

    Done

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:26 Reply

    Done

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:45 Reply

    Done
  27. core-ci voted on patch set 10 V -1 06/22/24, 11:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60071

  28. Markus Klein commented on patch set 11 V -1 06/22/24, 11:11

    Published edit on patch set 10.
  29. Markus Klein commented on patch set 12 06/22/24, 11:12

    Published edit on patch set 11.
  30. core-ci voted on patch set 11 V -1 06/22/24, 11:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60072

  31. core-ci voted on patch set 12 V +1 06/22/24, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60074

  32. Lina Wolf marked it work in progress 06/22/24, 15:03

  33. Lina Wolf uploaded patch set 13 V +1 06/23/24, 05:43

  34. Lina Wolf marked it ready for review 06/23/24, 05:46

  35. Lina Wolf marked it work in progress 06/23/24, 05:46

  36. Lina Wolf uploaded patch set 14 06/23/24, 05:47

  37. Lina Wolf marked it ready for review 06/23/24, 05:47

  38. core-ci voted on patch set 13 V -1 06/23/24, 05:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60088

  39. Lina Wolf uploaded patch set 15 06/23/24, 05:51

  40. core-ci voted on patch set 14 V -1 06/23/24, 05:56 Copied votes on follow-up patch sets have been updated: * Verified-1 has been copied to patch set 15 (copy condition: "changekind:NO_CHANGE"). Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60089

  41. core-ci voted on patch set 15 V -1 06/23/24, 05:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60090

  42. Lina Wolf uploaded patch set 16 V -1 06/23/24, 05:59

  43. core-ci voted on patch set 16 V +1 06/23/24, 06:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60091

  44. Stefan Froemken updated the commit message in patch set 17 V +1 06/23/24, 09:19

  45. core-ci voted on patch set 17 V +1 06/23/24, 09:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60093

  46. Stefan Froemken commented on patch set 17 CR -1 06/23/24, 09:35

    SuggestWizardController.php:129

    The DefaultRestrictionContainer also hides hidden records and records limited to start- and endtime. I would prefer to remove these limitations for this operation

    SuggestWizardController.php:130

    I don't understand $parentRow. The given $uid is the UID of the current record. Somewhere below you see that '###THIS_UID###' will be replaced by $uid. So why "parent"? Maybe currentRow or currentRecord would match better.

    SuggestWizardController.php:134

    $uid comes from parsedBody of request. Please case $uid to int here. IMO PARAM_INT will only handle the quoting for the query.

    SuggestWizardController.php:159

    no space

    SuggestWizardController.php:161

    no space
  47. Garvin Hicking commented on patch set 17 06/23/24, 11:08

    I think this is a very useful functionality, let's iron out the last things! 👏

    SuggestWizardController.php:129 Reply

    I agree on start/endtime, but why would you search and link to hidden elements? I'd say these would be intentionally not be "suggestable". definitely don't fetch deleted records here.

    SuggestWizardController.php:130 Reply

    I believe it's "parent" because all suggestsable records would be related to this element, to me this would work. Other ideas: sourceRow, originRow, relationRow. But "parent" is more commonly used in core?

    SuggestWizardController.php:159

    I think several other columns might make sense, too: backend_layout, colPos, starttime, endtime, fe_group, categories, l18n_parent, sectionIndex, pi_flexform These could allow some more flexibility, and maybe then it would be easier to expose all columns in a loop?

    tx_styleguide_elements_group.php:192

    Maybe add something like "suggestOption language related" to differentiate?
  48. Lina Wolf commented on patch set 17 06/23/24, 11:54

    SuggestWizardController.php:130 Reply

    Yes, parent, because we are in the suggest wizard here, where the childrecords of the current record are suggested
  49. Lina Wolf uploaded patch set 18 CR -1 V +1 06/23/24, 11:55

  50. Lina Wolf commented on patch set 17 06/23/24, 11:55

    SuggestWizardController.php:134 Reply

    Done

    SuggestWizardController.php:159 Reply

    Done

    SuggestWizardController.php:161 Reply

    Done
  51. core-ci voted on patch set 18 V +1 06/23/24, 12:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60102

  52. Lina Wolf commented on patch set 18 06/23/24, 12:00

    SuggestWizardController.php:129 Reply

    Actually this queryBuilder is used for the currently edited row, not the ones that are to be attached to it. You can edit a hidden record and only unhide it lateron so I would limit this to non-deleted records only. Good catch.
  53. Lina Wolf uploaded patch set 19 V +1 06/23/24, 12:01

  54. core-ci voted on patch set 19 V +1 06/23/24, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60104

  55. Lina Wolf uploaded patch set 20 V +1 06/23/24, 12:31

  56. Lina Wolf commented on patch set 20 06/23/24, 12:32

    tx_styleguide_elements_group.php:192 Reply

    Done
  57. core-ci voted on patch set 20 V +1 06/23/24, 12:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60106

  58. Lina Wolf uploaded patch set 21 V +1 06/23/24, 12:41

  59. core-ci voted on patch set 21 V +1 06/23/24, 12:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60107

  60. Stefan Froemken commented on patch set 21 CR -1 06/23/24, 13:41

    SuggestWizardController.php:159 Reply

    Done

    SuggestWizardController.php:163

    This line can be removed now. Further it contains the direct column name instead of the TCA "languageField"

    SuggestWizardController.php:164

    For performance reasons I would prefer to test for ###REC_FIELD first, before loop. In TYPO3 it is done with str_contains here: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php#L705
  1. Stefan Froemken commented on patch set 21 06/23/24, 13:52

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:15

    containing

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:18

    "can be used"

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:41

    tx_styleguide_elements_group.php:202

    column quoting with {#column}
  2. Garvin Hicking uploaded patch set 22 CR -1 V +1 07/19/24, 06:06

    Suggestions from code review plus rewording
  3. Garvin Hicking uploaded patch set 23 07/19/24, 06:13

    Add missing quoting
  4. Garvin Hicking commented on patch set 23 CR +1 V +1 07/19/24, 06:14

    Adapted the wordings a bit and addressed Stefans remarks, also tested/verified this works on my instance.

    SuggestWizardController.php:163 Reply

    Done

    SuggestWizardController.php:164 Reply

    Yes, that's a very good idea to save some unneeded iteration!

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:15 Reply

    Done

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:18 Reply

    Done

    Feature-96626 -AddSysLanguageUidMarkerToSuggestOptionsAddWhere.rst:41 Reply

    Good catch. I think it's okay to omit the table name here for better readability.

    tx_styleguide_elements_group.php:202 Reply

    Done
  5. core-ci voted on patch set 22 V +1 07/19/24, 06:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61782

  6. core-ci voted on patch set 23 V -1 07/19/24, 06:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61783

  7. core-ci commented on patch set 23 07/19/24, 09:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61783

  8. core-ci voted on patch set 23 V +1 07/19/24, 09:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61783

  9. Fabien Udriot voted on patch set 23 CR +1 07/19/24, 11:39

  10. Georg Ringer commented on patch set 23 08/01/24, 21:27

    SuggestWizardController.php:129

    I suggest just using BackendUtility::getRecord() would be perfectly fine, what do you think?
  11. Garvin Hicking uploaded patch set 24 CR +1 V +1 08/06/24, 23:10

    Add tests adjust wording use getRecord
  12. Garvin Hicking uploaded patch set 25 08/06/24, 23:10

    Adjust CGL
  13. core-ci voted on patch set 25 V +1 08/06/24, 23:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62978

  14. core-ci voted on patch set 24 V -1 08/06/24, 23:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62977

  15. Garvin Hicking commented on patch set 25 CR +1 V +1 08/06/24, 23:22

    Adapted wordings again, added some basic testing (had to refactor the method to make it testable at least superficially), and now use BU:getRecord instead of custom query. Still works. ;)

    SuggestWizardController.php:129 Reply

    Done
  16. Stefan Froemken commented on patch set 25 08/07/24, 19:00

    SuggestWizardControllerTest.php:269

    BackendUtility::getRecord can return null. Can we use this test to test against $parentRow with NULL?
  17. Garvin Hicking uploaded patch set 26 CR +1 V +1 08/07/24, 19:23

    Enhance test rename ReST file
  18. Stefan Froemken voted on patch set 26 CR +1 08/07/24, 19:28

  19. core-ci voted on patch set 26 V +1 08/07/24, 19:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63015

  20. Garvin Hicking voted on patch set 26 CR +1 V +1 08/07/24, 19:31

  21. Garvin Hicking commented on patch set 26 08/07/24, 19:31

    SuggestWizardControllerTest.php:269 Reply

    Done
  22. Stefan Bürk voted on patch set 26 CR -1 08/18/24, 08:38

  23. Stefan Bürk commented on patch set 26 CR -2 08/19/24, 07:29

    Unresolved

    Commit message not reflecting what the current change / approach really does.

    SuggestWizardController.php:328 Unresolved

    I get the intention to add `sys_language_uid`, albeit already asking the "use-fullness" of that. However, the choosen approach here to add all record field values as "placeholder" replacement is not a good idea and thus the -2: This approach does not take field types into account, for example VARCHAR, TEXTFIELDS or blob fields. They need to be properly quoted in a query, which is not done here. On top of that, that is not so simple - see https://review.typo3.org/c/Packages/TYPO3.CMS/+/73172/26/typo3/sysext/backend/Classes/Controller/Wizard/SuggestWizardController.php#158 comment for the hack. A simple quoting is also not correct here and would quote integer values (or booleans) which may lead to comparision issues, for example on Postgres when the field type does not match with the replaced one. In the current form, this may also open a security hole (multi step attack) without proper quoting on varchar/text columns. Implementing a general solution here will become hard to do it right - beside that, people may ask for these placeholder in other parts too. Current commit message does not reflect the current choosen approach anyway. I'd suggest to narrow this change down to the original intention: * only handle sys_language_uid field (read fieldname from TCA, using a generic placeholdername despite the "configurable" row name) * ensur integer values * align commit message towards the change and what it currently does If parent row is not localizable no replacement would be done (maybe describe that in the rest file). TBH I'm not quite sure if the `sys_language_uid` placeholer really make sense as a generic option. I'd say peoply really quickly wants to respect language fallbacks than - or what do you say ?

    SuggestWizardControllerTest.php:262 Unresolved

    let us use prefixees for test datasets aka named argument usages (phpunit. Meaning that the values for the text method should be added here ``` return [ 'some string' => [ 'expected' => [], 'array' => [], ], ]; ``` beside that `$array` may not be a good name here.
  24. Garvin Hicking commented on patch set 26 CR 0 V 0 08/19/24, 13:22

    I understand the concerns, thanks for bringing them up. I think to have REC_FIELD_sys_language_uid available (probably as ORIGIN_LANGUAGE_UID?) is the main concern; maybe some othe INT fields, too. I'll try to find some time to make the scope of this patch smaller with only these fields. Maybe in v14 we can then address a way to add VARCHAR fields too, if people ask for it.
  25. Lina Wolf abandoned the change 11/05/25, 13:29

    I think a different attempt needs to be made if we want to solve this