Issue Feature Under Review Stale

#97259Add option to pass additionalFields to PageTreeRepository, when building the tree

Philipp Wrann 03/30/22, 14:01 updated 09/20/26, 05:46

Description

Using the Hook $GLOBALS[‘TYPO3_CONF_VARS’][‘SC_OPTIONS’][\TYPO3\CMS\Core\Imaging\IconFactory::class][‘overrideIconOverlay’] it is possible to modify the overlay-icon for icons created with the IconFactory class. But it is not possible to add custom overlays based on new fields (pages table) for the page-tree because the row will never contain the fields you added.

The PageTreeRepository can receive additional fields to select in the constructor but the TreeController does pass a hard-coded empty array.

The hook to midify the icon overlay:
https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Imaging/IconFactory.php#L361

Called here:
https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Controller/Page/TreeController.php#L370

PageTreeRepository instantiation responsible for loading the page record:
https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Controller/Page/TreeController.php#L486

Query created by repository:
https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php#L520

What i want to achieve:

I simply added a field to the pages table to disable robots (recursive) for the page and all sub-pages. To show the setting to a logged in backend-user i want to display a overlay ontop of that page. Something like a stop-sign. At the moment there is no safe way (besides XClassing or firing a second query to fetch the new field inside the hook) of adding such a feature.

By adding a configuration like $GLOBALS[‘TYPO3_CONF_VARS’][‘BE’][‘pageTreeAdditionalFields’] and merging that field additionally inside the PageTreeRepository, this could be enhanced very easily.

Reviews 1

History 410

  1. Susanne Moog changed Complexity no-brainer medium Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2022-08-05T12:58:29+00:00" > 08/05/22, 12:58 </span>

  2. Konrad Michalik commented <span data-processor="relativetime" data-value="2026-08-10T13:24:42+00:00" > 08/10/26, 13:24 </span>

    I would like to pick this up and provide a patch.

    Second real world use case: EXT:xima_typo3_content_planner displays an editorial status per page in the page tree. Listeners of AfterPageTreeItemsPreparedEvent only receive the fields hardcoded in PageTreeRepository, so we ended up XCLASSing TreeController, exactly one of the two workarounds described above.

    Regarding the proposed $GLOBALS[‘TYPO3_CONF_VARS’][‘BE’][‘pageTreeAdditionalFields’]: a PSR-14 event would fit the current core direction better and allows listeners to decide per request whether a field is needed at all. Draft: ModifyPageTreeQueryFieldsEvent, dispatched in TreeController::initializePageTreeRepository(), collecting field names that are passed as $additionalFieldsToQuery to PageTreeRepository.

    If a plain configuration array is preferred by the team, I am happy to implement that instead. I will push a patch to Gerrit once there is a short signal on the preferred direction.