#96385Treelevel wrong in PageTS conditions
Description
For an TYPO3 upgrade I’ve had to migrate oldschool PageTS conditions to symfony expression syntax.
That’s when I’ve noticed that [tree.level = X] is behaving differently than [treeLevel = X] used to do. We’ve usually used this to show certain fields only on site root level, e.g. is_siteroot, backend_layout and backend_layout_next_level.
First off we hide certain fields globally:
TCEFORM.pages.is_siteroot.disabled = 1 TCEFORM.pages.backend_layout.disabled = 1 TCEFORM.pages.backend_layout_next_level.disabled = 1
But show them on root pages (old syntax):
[treeLevel = 0] TCEFORM.pages.is_siteroot.disabled = 0 TCEFORM.pages.backend_layout.disabled = 0 TCEFORM.pages.backend_layout_next_level.disabled = 0 [global]
Which translates to the new syntax:
[tree.level == 1] TCEFORM.pages.is_siteroot.disabled = 0 TCEFORM.pages.backend_layout.disabled = 0 TCEFORM.pages.backend_layout_next_level.disabled = 0 [global]
As you can see, there’s a difference in what’s considered to be treelevel 0. In my opinion that’s a bug.
Another thing is that for nested sites the treelevel is not reset even though there’s a sys_template record with root=1 set that is processed correctly in FE TypoScript.
So to make the snippet work for PageTS we gotta use this for a root site that’s located on absolute treelevel 3:
[tree.level == 4] TCEFORM.pages.is_siteroot.disabled = 0 TCEFORM.pages.backend_layout.disabled = 0 TCEFORM.pages.backend_layout_next_level.disabled = 0 [global]
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] Treelevel wrong in PageTS conditions Resolves: #96385 Releases: main