#92120Condition tree.rootLineIds does not work in User TSconfig
Description
In TYPO3 8 I’ve been setting the following default User TSconfig in ext_localconf.php via ExtensionManagementUtility::addUserTSConfig:
[PIDinRootline = 123]
options.defaultUploadFolder = 1:myuploads/mywebsite1/
[END]
[PIDinRootline = 456,789]
options.defaultUploadFolder = 1:myuploads/mywebsite2/
[END]
In TYPO3 10 I’m now trying to use the new condition syntax based on symfony expression language without success:
[123 in tree.rootLineIds]
options.defaultUploadFolder = 1:myuploads/mywebsite1/
[END]
[456 in tree.rootLineIds || 789 in tree.rootLineIds]
options.defaultUploadFolder = 1:myuploads/mywebsite2/
[END]
Using a condition like [page["uid"] == 124] for a single page works fine but I cannot manage to make tree.rootLineIds work. I noticed there a few bug reports regarding conditions and User TSconfig but none of them seems to be related to tree.rootLineIds.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 4
-
Tobias Schmidt changed category <span data-processor="relativetime" data-value="2020-09-30T09:47:54+00:00" > 09/30/20, 09:47 </span>
-
Bernhard Eckl commented <span data-processor="relativetime" data-value="2021-07-29T16:27:04+00:00" > 07/29/21, 16:27 </span>
Same problem here. Hundreds of files are now in the wrong place since I made the update. Can somebody fix it?
-
Benni Mack commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-11-06T07:37:52+00:00" > 11/06/26, 07:37 </span>User TSconfig is resolved per backend user without page context, so page-related conditions (page, pageId, rootLine, tree) cannot work there by design. Since TYPO3 v12.3 (#83608), options.defaultUploadFolder can be set in page TSconfig and overrides the user TSconfig value. Page TSconfig supports [123 in tree.rootLineIds]. For custom logic, use the PSR-14 event AfterDefaultUploadFolderWasResolvedEvent which we have in place without an extension. Closing this issue, since the use case is covered.
I can confirm this behavior!
Additionally, the User TSconfig is cached. Therefore, I guess, the condition logic is not evaluated switching pages.
Currently, the best way to change the defaultUploadFolder seems to be using this hook (eg. used by beechit/default_upload_folder).
I would appreciate a solution within the core (either by using TS conditions or by introducing a new page TSconfig option). This does not seem to be easy though.