Bug #96385
openTreelevel wrong in PageTS conditions
0%
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]
Updated by Lina Wolf over 2 years ago
- Category set to FormEngine aka TCEforms
We need to document, if this change in behavior was intended https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-TSconfig/issues/157, fix it if not intended.
Updated by Benni Mack over 1 year ago
- Status changed from New to Accepted
Hey Philipp,
good point, I think the new solution (starting at "1") is a better starting number than "0". I think we should document this. Will put this to the docs team.
Updated by Philipp Kitzberger over 1 year ago
Ehm, in TypoScript it's starting with 0 though. I think we shouldn't have a difference here.