95260[FEATURE] Introduce event to extend page tree query fields
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 6
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/60/95260/6 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/60/95260/6 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Relation chain 2
-
main
95134[BUGFIX] Allow PHP enums as `<f:form.select>` options
The chain has patch set 8 of 11, the changes above it need a rebase.
-
95260 [FEATURE] Introduce event to extend page tree query fields This change
Merge conflicts 2
Issues 1
Files 5
- typo3/sysext/backend/Classes/Controller/Event/BeforePageTreeIsQueriedEvent.php3new+45 −0
- typo3/sysext/backend/Classes/Controller/Page/TreeController.php+2 −1
- typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php+35 −0
- typo3/sysext/backend/Tests/Unit/Controller/Event/BeforePageTreeIsQueriedEventTest.phpnew+49 −0
- typo3/sysext/core/Documentation/Changelog/15.0/Feature-97259-PSR14BeforePageTreeIsQueriedEvent.rstnew+79 −0
Review log 1420
-
Konrad Michalik uploaded patch set 1 08/11/26, 08:05
-
core-ci voted on patch set 1 V +1 08/11/26, 08:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106408
-
Garvin Hicking voted on patch set 1 CR +1 V +1 08/11/26, 09:26
-
Oli Bartsch commented on patch set 1 08/11/26, 15:49
-
Konrad Michalik uploaded patch set 2
CR +1V +108/12/26, 06:17 -
core-ci voted on patch set 2 V +1 08/12/26, 06:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106491
-
Garvin Hicking voted on patch set 2 CR +1 V +1 08/12/26, 06:37
-
Benni Mack commented on patch set 2 CR -1 08/12/26, 06:45
I suggest we first free the constructor of the Repository, and then handle the field list better. -
Konrad Michalik commented on patch set 2 08/12/26, 07:42
Reply
Agreed, and that's the root cause rather than a detail. `$fields`, `$quotedFields`, `$currentWorkspace` and `$additionalQueryRestrictions` are all `readonly` and assigned in the constructor, so the field list is frozen before any extension point can run. This change works around that instead of fixing it, and I'm not attached to the current shape: if a freed constructor makes a different extension point more natural, I'm happy to rework this or drop the event entirely. For sizing: the class is marked `@internal this class is not public API yet`, so the constructor signature can change without a breaking changelog, and 5 of the 6 instantiation sites already call `makeInstance(PageTreeRepository::class)` with no arguments, `TreeController` is the only caller passing any. Is the refactoring something the team already has planned, or is it up for grabs? In the first case I'll wait and rebase on top; in the second I can prepare it as a separate task change. Either way, should I park this change as WIP in the meantime?BeforePageTreeIsQueriedEvent.php:41ReplyDone, I went with the check in `addField()` rather than `array_unique()` in the getter. `array_unique()` preserves keys, so with a duplicate in the middle the getter would return a list with a gap (`array_unique(["slug","abstract","slug","author"])` gives `[0 => 'slug', 1 => 'abstract', 3 => 'author']`) and would no longer match its `string[]` annotation, that would need an extra `array_values()` around it. Guarding on write keeps the array a proper list at all times. Added a unit test for it. One limitation worth mentioning: `PageTreeRepository::__construct()` does `array_merge($defaults, $additionalFieldsToQuery)` without deduplication, so a listener calling e.g. `addField('title')` still produces a duplicate column in the SELECT, the event cannot see collisions with the 32 default fields. It is harmless in SQL, but if you want uniqueness guaranteed end to end, `array_unique()` there would be the right place. Happy to include that in this change if you prefer, I left it out to keep the scope tight. -
Radostin Milenov uploaded patch set 3
CR +1V +109/13/26, 06:59 -
core-ci voted on patch set 3 V +1 09/13/26, 07:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108442
-
Konrad Michalik commented on patch set 3 09/17/26, 15:01
Hi Radostin, thanks for rebasing this onto current main. I noticed patch set 3 also drops two things from patch set 2 that were added based on review feedback: the in_array duplicate-check in BeforePageTreeIsQueriedEvent::addField(), and the fieldsAreAddedOnlyOnce() unit test covering it. Was that intentional, or did it get lost during a rebase/cherry-pick? Happy to restore both in a follow-up patch set if it was not deliberate. -
Radostin Milenov commented on patch set 3 09/17/26, 15:32
That wasn’t intended. Will take care of it. -
Radostin Milenov rebased onto patch set 4
V +109/20/26, 04:30 -
core-ci voted on patch set 4 V +1 09/20/26, 04:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108874
-
Radostin Milenov uploaded patch set 5
V +109/20/26, 04:41 -
Radostin Milenov commented on patch set 5 09/20/26, 04:43
Reply Unresolved
DoneSorry about that appaently i somehow broke my envrionment had to set it up fresh.BeforePageTreeIsQueriedEvent.php:41ReplyDone -
core-ci voted on patch set 5 V -1 09/20/26, 04:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108876
-
Radostin Milenov commented on patch set 6
V -109/20/26, 05:46Published edit on patch set 5. -
core-ci voted on patch set 6 V +1 09/20/26, 05:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108880
BeforePageTreeIsQueriedEvent.php:41