Review main Merged

80436[FEATURE] Introduce new PSR-14 `BeforeLiveSearchFormIsBuiltEvent`

Guido Schmechel CR +2 V +2 Hard +583 −2 updated 03/29/25, 06:41

Commit message

This change introduces a new PSR-14 `BeforeLiveSearchFormIsBuiltEvent`
which is dispatched in the LiveSearch form action. This event allows
extension developer to add, change or remove hints to the live search
form or change the search demand object.

Furthermore, additional view data can be provided and used in a
overridden module action template. This avoids the need for using
the `XCLASS` technique to provide additional data.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 7396

Show 5471 earlier messages
  1. Guido Schmechel uploaded patch set 1 08/07/23, 22:06

  2. core-ci voted on patch set 1 V +1 08/07/23, 22:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45204

  3. Oli Bartsch commented on patch set 1 CR -1 08/07/23, 22:32

    Could we have some basic test for the new event?

    ModifyHintsInLiveSearchEvent.php:21

    hints in the

    ModifyHintsInLiveSearchEvent.php:33

    For convenience, let's add an `addHint` / `setHint` method.

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:6

    live search

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:16

    live search

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:30

    Suggest to replace this with "Backend\Search"

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:50

    live search

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:53

    ext:backend
  4. Guido Schmechel uploaded patch set 2 CR -1 V +1 08/08/23, 20:40

  5. core-ci voted on patch set 2 V +1 08/08/23, 20:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45263

  6. Guido Schmechel commented on patch set 2 CR -1 08/08/23, 20:48

    On it

    ModifyHintsInLiveSearchEvent.php:21 Reply

    Done

    ModifyHintsInLiveSearchEvent.php:33 Reply

    Done

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:6 Reply

    Done

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:16 Reply

    Done

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:30 Reply

    Done

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:50 Reply

    Done

    Feature-99409-AddPSR-14EventForLivesearchHints.rst:53 Reply

    Done
  7. Guido Schmechel updated the commit message in patch set 3 CR -1 V +1 08/08/23, 21:22

  8. Guido Schmechel uploaded patch set 4 08/08/23, 21:23

  9. core-ci voted on patch set 3 V +1 08/08/23, 21:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45265

  10. core-ci voted on patch set 4 V +1 08/08/23, 21:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45266

  11. Guido Schmechel commented on patch set 4 08/08/23, 21:33

    Reply

    Done
  12. Jörg Bösche voted on patch set 4 CR +1 08/10/23, 12:58

  13. Simon Schaufelberger voted on patch set 4 CR +1 08/25/23, 17:59

  14. Thomas Hohn voted on patch set 4 CR +1 09/14/23, 04:35

  15. Stefan Bürk commented on patch set 4 CR -1 09/22/23, 15:55

    LiveSearchController.php:83

    Maybe we should dispatch the event later, rename it a little bit and add additional values to the event so it can be adjusted: * `$request`: should be added in any cases, gives more context to the event to react dynamiclly in the event listener * `$searchDemand` so it adjusted by extension developers Not sure about `$searchProviders` ...
  16. Stefan Bürk commented on patch set 4 09/22/23, 15:58

    ModifyHintsInLiveSearchEvent.php:29

    We should add a `@return string[]` here not sure if that is correct, but I guess Oliver Klee may be come up with a better one. Same for `setHints()` argument `$hints`.
  17. Oliver Klee commented on patch set 4 09/22/23, 16:11

    ModifyHintsInLiveSearchEvent.php:29 Reply

    We can be even more specific here (as the controller has full control over what data the event gets) and use `list<non-empty-string>`.
  18. Guido Schmechel commented on patch set 4 09/22/23, 16:33

    LiveSearchController.php:83 Reply

    Where could you imagine having a connection between hints and context? In live mode, please take out the hint on xyz? Have you thought of something like that? Moving it further down is basically no problem. I don't have the imagination for the searchProviders at the moment, but in the best case I'd probably like more information in one event ;-) Just for my understanding: I have a feeling you're not just thinking about the hints, but something bigger to modify more stuff?
  19. Guido Schmechel commented on patch set 4 09/22/23, 16:36

    LiveSearchController.php:83 Reply

  20. Stefan Bürk commented on patch set 4 09/22/23, 16:50

    LiveSearchController.php:83 Reply

    Hint based on "active" searchProviders or because of some request things ? Not really a use case, but try to come up which may some would need. We often have the issue that at some point no request is available, but needed for someone. So at least the request should be passed along to avoid using $GLOBALS['TYPO3_REQUEST'] in the event listener if needed. Therefore, I would make that event here more a generic event to define what should end up in the view. That way, someone can use the event to do that instead of xclassing the controller. Therefore, an additional "viewData" array may be usefull. Just thinking ... not played around with the LiveSearch on my own. But avoiding a "named" event and having later another one is contra-productive .. and there is no much handling logic, so having here a more "ModifyLiveSearchFormActionViewData" event would be more suitable for a lot more possible use-cases. What do you think ?
  21. Guido Schmechel commented on patch set 4 CR -1 09/22/23, 17:21

    LiveSearchController.php:83 Reply

    No problem, I was just looking for an understanding. For me, the hints have been sufficient so far. For the name, I would go for ModifyLiveSearchFormData, but that's debatable ;-) Thanks for your feedback. I'll try to work it in.
  22. Guido Schmechel uploaded patch set 5 CR +1 V +1 09/22/23, 20:40

  23. core-ci voted on patch set 5 V -1 09/22/23, 20:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47103

  24. Guido Schmechel uploaded patch set 6 V -1 09/22/23, 20:53

  25. core-ci voted on patch set 6 V -1 09/22/23, 21:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47104

  26. Guido Schmechel uploaded patch set 7 V -1 09/22/23, 21:04

  27. core-ci voted on patch set 7 V +1 09/22/23, 21:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47105

  28. Stefan Bürk commented on patch set 7 09/22/23, 21:11

    Feature-99409-AddPSR-14EventForLiveSearchForm.rst:26

    Use normal dashes here to have the example as a sub-category for Description please. ``` Example ------- ```
  29. Stefan Bürk commented on patch set 7 09/22/23, 21:13

    And we should add some functional tests: * ensure that the event is dispatched if the formAction is called (a event listener can catch the event) * check that when a event listener is changing something, for example adding custom hints, that it is added in the output and similar things
  30. Guido Schmechel commented on patch set 7 09/24/23, 13:22

    Reply

    I took a look at the whole thing. I don't have the testing experience for dispatching. Especially in relation to calling a backend function like the formAction. Maybe you have a similar test somewhere in the core for inspiration. But my problem with the formAction remains ;-) We have a unit test for changing the hints. In my opinion, that should be enough, since we have no external data reference, such as a database. How do you see this?
  31. Stefan Bürk commented on patch set 7 CR -1 09/25/23, 08:53

    -1 will take care of the additional tests the next days

    Reply

    -1 will take care of the additional tests the next days
  32. Stefan Bürk uploaded patch set 8 CR -1 V +1 09/26/23, 15:26

  33. Stefan Bürk voted on patch set 8 CR -1 09/26/23, 15:29

  34. core-ci voted on patch set 8 V +1 09/26/23, 15:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47190

  35. Stefan Bürk uploaded patch set 9 CR -1 V +1 09/26/23, 16:04

  36. Stefan Bürk commented on patch set 9 09/26/23, 16:07

    Reply

    Added some functional tests to cover the real dispatching.

    Reply

    Done

    Feature-99409-AddPSR-14EventForLiveSearchForm.rst:26 Reply

    Done
  37. core-ci voted on patch set 9 V +1 09/26/23, 16:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47192

  38. Oliver Klee commented on patch set 9 09/26/23, 16:17

    ModifyHintsInLiveSearchEvent.php:29 Reply

    Done
  39. Andreas Kienast commented on patch set 9 09/27/23, 12:11

    LiveSearchControllerTest.php:106

    I think we can drop this check. If `$lastEventObject` is an instance of `ModifyLiveSearchFormDataEvent`, this assertion is always true. If not, the previous assertion will fail anyway.
  40. Stefan Bürk commented on patch set 9 09/27/23, 13:15

    LiveSearchControllerTest.php:106 Reply

    Ack
  41. Stefan Bürk uploaded patch set 10 V +1 09/27/23, 13:16

  42. Stefan Bürk commented on patch set 10 09/27/23, 13:16

    LiveSearchControllerTest.php:106 Reply

    Done
  43. core-ci voted on patch set 10 V -1 09/27/23, 13:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47244

  44. Stefan Bürk uploaded patch set 11 V -1 09/28/23, 15:25

  45. core-ci voted on patch set 11 V +1 09/28/23, 15:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47291

  46. Oliver Klee voted on patch set 11 V +1 09/28/23, 15:57

  47. Stefan Bürk voted on patch set 11 V +1 CR +1 09/29/23, 10:53

  48. Oli Bartsch commented on patch set 11 09/29/23, 13:30

    LiveSearchController.php:88

    Since the created object is only used in the event, lets create it in the event's constructor instead.

    LiveSearchController.php:89

    So should we not just make this property optional by defining a default value in the event's contructor?
  49. Simon Schaufelberger commented on patch set 11 CR -1 10/01/23, 09:37

    locallang_misc.xlf:3

    product-name needs to be the extension name which is test_live_search_controller_events in this case.
  50. Stefan Bürk uploaded patch set 12 CR +1 V +1 10/05/23, 09:15

  51. Stefan Bürk commented on patch set 12 10/05/23, 09:15

    LiveSearchController.php:88 Reply

    Done

    LiveSearchController.php:89 Reply

    Done

    locallang_misc.xlf:3 Reply

    Done
  52. core-ci voted on patch set 12 V +1 10/05/23, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47429

  53. Stefan Bürk voted on patch set 12 V +1 CR +1 10/05/23, 12:26

  54. Oliver Klee wrote 10/05/23, 15:13

    Removed reviewer Oliver Klee.
  55. Oli Bartsch voted on patch set 12 V +1 CR +1 10/06/23, 13:55

  56. Oli Bartsch uploaded patch set 13 CR +1 V +1 10/06/23, 14:05

  57. Oli Bartsch voted on patch set 13 V +1 CR +1 10/06/23, 14:05

  58. core-ci voted on patch set 13 V +1 10/06/23, 14:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47499

  59. Jörg Bösche voted on patch set 13 CR +1 10/27/23, 07:18

  60. Simon Schaufelberger uploaded patch set 14 CR +1 V +1 04/21/24, 21:17

  61. Simon Schaufelberger commented on patch set 14 04/21/24, 21:18

    This one was laying around for so long with a lot of votes that it became not mergeable again. I hope it will make it this time ;)
  62. core-ci voted on patch set 14 V -1 04/21/24, 21:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56445

  63. Simon Schaufelberger uploaded patch set 15 V -1 04/21/24, 21:30

  64. core-ci voted on patch set 15 V +1 04/21/24, 21:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56446

  65. Chris Müller uploaded patch set 16 V +1 05/02/24, 17:47

  66. core-ci voted on patch set 16 V +1 05/02/24, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57108

  67. Andreas Kienast commented on patch set 16 06/04/24, 07:22

    What might be a suitable use-case for the event? Additional hints: I get it, but that should IMO become patches. What kind of Fluid changes might be necessary here?
  68. Guido Schmechel commented on patch set 16 07/11/24, 17:54

    Reply

    I don't know if I've understood it completely, but I'll give it a try: The original idea was to be able to integrate external documentation into the TYPO3 search. I would also like to be able to add the notes independently as a developer. That's why it was once planned to implement this here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80536
  69. Guido Schmechel rebased onto patch set 17 V +1 01/19/25, 16:13

  70. Guido Schmechel uploaded patch set 18 01/19/25, 16:16

  71. core-ci voted on patch set 17 V -1 01/19/25, 16:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72685

  1. core-ci voted on patch set 18 V -1 01/19/25, 16:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72686

  2. Oli Bartsch uploaded patch set 19 V -1 01/20/25, 09:57

  3. core-ci voted on patch set 19 V +1 01/20/25, 10:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72716

  4. Oli Bartsch voted on patch set 19 CR +1 V +1 01/20/25, 10:07

  5. Josef Glatz updated the commit message in patch set 20 CR +1 V +1 02/24/25, 18:44

  6. core-ci voted on patch set 20 V +1 02/24/25, 18:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74634

  7. Oli Bartsch voted on patch set 20 CR +1 V +1 02/25/25, 08:45

  8. Andreas Kienast voted on patch set 20 CR +1 V +1 02/28/25, 11:37

  9. Christian Kuhn commented on patch set 20 CR -1 03/02/25, 01:33

    @bo@cedev.de or @a.herzog@kienastdv.de could you have a look to get details right?

    LiveSearchController.php:86

    this usage of named arguments violates our rules.

    ModifyLiveSearchFormDataEvent.php:37

    why are there 3 arguments when the event is created with only 2?
  10. Andreas Kienast commented on patch set 20 03/02/25, 10:00

    LiveSearchController.php:86 Reply

    Thanks, I didn't spot this.

    ModifyLiveSearchFormDataEvent.php:37 Reply

    Acknowledged
  11. Andreas Kienast uploaded patch set 21 CR +1 V +1 03/02/25, 10:00

  12. Andreas Kienast commented on patch set 21 03/02/25, 10:01

    LiveSearchController.php:86 Reply

    Done
  13. core-ci voted on patch set 21 V -1 03/02/25, 10:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74962

  14. Andreas Kienast uploaded patch set 22 V -1 03/02/25, 10:51

  15. core-ci voted on patch set 22 V +1 03/02/25, 10:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74965

  16. Jörg Bösche voted on patch set 22 CR +1 03/24/25, 09:04

  17. Andreas Kienast voted on patch set 22 CR +1 V +1 03/26/25, 12:47

  18. Benni Mack commented on patch set 22 CR -1 03/26/25, 17:07

    I don't want to picky here, but an Event should be named as it is - when it occurs - and not what you can do with it. I tried my best to keep this line for 95% of the introduced Events, so please rename this Event to "AfterWhateverWasDoneWithThatDateInCoreLiveSearchEvent" - people might not want to "Modify" something, but rather be a subscriber to the event to trigger stats how often people used the live search.
  19. Andreas Kienast uploaded patch set 23 CR +1 V +1 03/27/25, 15:29

  20. Andreas Kienast commented on patch set 23 03/27/25, 15:33

    Reply

    Done
  21. core-ci voted on patch set 23 V +1 03/27/25, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76475

  22. Andreas Kienast voted on patch set 23 CR +1 V +1 03/27/25, 15:48

  23. Georg Ringer voted on patch set 23 CR +2 V +2 03/27/25, 15:58

  24. Georg Ringer merged patch set 24 03/27/25, 15:58

  25. Lina Wolf commented on patch set 24 03/29/25, 06:41