Review main Merged

76854[FEATURE] Add event to modify backend search results

Andreas Kienast CR +2 V +2 Hard +298 −1 updated 12/23/22, 09:48

Commit message

A new event `ModifyResultItemInLiveSearchEvent` is added that allows to
modify search result items in a custom event handler, which may come in
handy for 3rd party integrations to add custom actions to search
results.

The `ResultItem` object received a new `internalData` attribute to be
used for data that is not meant to be exposed in responses, e.g.
database rows.

As a proof-of-concept, search results from the `be_users` table now
have a "switch user" action.

This feature is purposely not documented as such as behavior or API may
change in further iterations.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Guido Schmechel +1
  • Verified V +2 Done
    • Benni Mack +2
    • Guido Schmechel +1
    • core-ci +1 CI

Issues 1

Files 11

Review log 1521

  1. Andreas Kienast uploaded patch set 1 11/29/22, 12:12

  2. core-ci voted on patch set 1 V -1 11/29/22, 12:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34360

  3. Andreas Kienast uploaded patch set 2 V -1 11/29/22, 12:44

  4. core-ci voted on patch set 2 V +1 11/29/22, 12:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34361

  5. Benni Mack commented on patch set 2 CR -1 12/02/22, 21:53

    Must be a feature
  6. Andreas Kienast uploaded patch set 3 CR -1 V +1 12/05/22, 14:48

  7. Chris Müller uploaded patch set 4 12/05/22, 14:53

  8. core-ci voted on patch set 3 V +1 12/05/22, 14:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34639

  9. core-ci voted on patch set 4 V +1 12/05/22, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34640

  10. Benni Mack commented on patch set 5 V +1 12/06/22, 10:48

    Published edit on patch set 4.
  11. core-ci voted on patch set 5 V +1 12/06/22, 10:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34705

  12. Guido Schmechel commented on patch set 5 12/15/22, 23:26

    Feature-99220-AddEventToModifySearchResults.rst:39

    Can we add the other imports here? Then the example would be complete

    Feature-99220-AddEventToModifySearchResults.rst:54

    I tested the example and pages did not expand for me. Two issues: 1.) The value "table" in getExtraData() was always missing in that case. (No addition in PageRecordProvider) It worked with a tt_content example. 2.) The eventlistener blocks PageRecordProvider: if ($resultItem->getProviderClassName() !== DatabaseRecordProvider::class) { return; } If I adjust the two places, it works.

    Feature-99220-AddEventToModifySearchResults.rst:58

    I would suggest we take a real example here to include URL routing. In my example, I had linked the history of the data set.
  13. Andreas Kienast commented on patch set 5 CR -1 12/16/22, 08:18

    Feature-99220-AddEventToModifySearchResults.rst:39 Reply

    Ack

    Feature-99220-AddEventToModifySearchResults.rst:54 Reply

    Alright, the example is complete bollocks here. Will update it to use tt_content instead.

    Feature-99220-AddEventToModifySearchResults.rst:58 Reply

    Ack
  14. Andreas Kienast uploaded patch set 6 CR -1 V +1 12/16/22, 08:26

  15. Andreas Kienast commented on patch set 6 12/16/22, 08:26

    Feature-99220-AddEventToModifySearchResults.rst:54 Reply

    Done
  16. core-ci voted on patch set 6 V +1 12/16/22, 08:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35188

  17. Guido Schmechel commented on patch set 6 12/16/22, 21:33

    Feature-99220-AddEventToModifySearchResults.rst:54 Reply

    Thank you! Is it intentional that table pages should not be expanded with the event?
  18. Andreas Kienast commented on patch set 6 12/17/22, 06:59

    Feature-99220-AddEventToModifySearchResults.rst:54 Reply

    It‘s meant as an example to show you‘re able to limit the event listener for specific providers.
  19. Guido Schmechel commented on patch set 6 V +1 CR +1 12/17/22, 14:29

    Feature-99220-AddEventToModifySearchResults.rst:54 Reply

    Thanks for your explanation :-)
  20. Benni Mack voted on patch set 6 V +2 CR +2 12/23/22, 09:48

  21. Benni Mack merged patch set 7 12/23/22, 09:48