Skip to content

[FEATURE] Migrate more TS conditions#383

Merged
simonschaufi merged 1 commit intoandreaswolf:mainfrom
kitzberger:more-typoscript-conditions
Mar 10, 2026
Merged

[FEATURE] Migrate more TS conditions#383
simonschaufi merged 1 commit intoandreaswolf:mainfrom
kitzberger:more-typoscript-conditions

Conversation

@kitzberger
Copy link
Copy Markdown
Contributor

Migrations for v10:

Legacy condition Migrated (v10 syntax)
[globalVar = GP:key > 0] [request && traverse(request.getQueryParams(), 'key') > 0]
[globalVar = GP:tx_ext|field > 0] [request && traverse(request.getQueryParams(), 'tx_ext/field') > 0]
[globalVar = GP:tx_ext|field !=] [request && traverse(request.getQueryParams(), 'tx_ext/field') != ""]
[globalVar = TSFE:id = {$page.home}] [page["uid"] == {$page.home}]
[globalVar = TSFE:page|doktype = 3] [page["doktype"] == 3]
[globalVar = TSFE:type = 1449874941] [getTSFE().type == 1449874941]
[globalVar = TSFE:beUserLogin = 1] [getTSFE().beUserLogin == 1]
[globalVar = LIT:1 = {$const}] [{$const} == 1]
[globalVar = LIT:1 != {$const}] [{$const} != 1]
[globalVar = BE_USER|user|admin = 1] [backend.user.isAdmin]
[globalString = IENV:HTTP_HOST = example.org] [request.getNormalizedParams().getHttpHost() == "example.org"]
[globalString = TSFE:id=2111] [page["uid"] == 2111]
[PIDinRootline = 89,130] [89 in tree.rootLineIds || 130 in tree.rootLineIds]
[PIDinRootline = {$page.foo}] [{$page.foo} in tree.rootLineIds]
[PIDupinRootline = 89,130] [89 in tree.rootLineParentIds || 130 in tree.rootLineParentIds]
[applicationContext = Development] [applicationContext == "Development"]
[applicationContext = Development*] [like(applicationContext, "Development*")]
[treeLevel = 1,3] [tree.level in [1,3]]

And for v12:

v10 syntax Migrated (v12 syntax)
[loginUser = *] [frontend.user.isLoggedIn]
[usergroup = *] [frontend.user.userGroupIds !== [0, -1]]
[usergroup = 1,2] [1 in frontend.user.userGroupIds || 2 in frontend.user.userGroupIds]
[globalVar = TSFE:type = 9818] [request.getPageArguments()?.getPageType() == '9818']
[globalVar = TSFE:beUserLogin > 0] [getTSFE()?.isBackendUserLoggedIn()]

@kitzberger kitzberger force-pushed the more-typoscript-conditions branch from 8f5173b to 7a4db19 Compare March 10, 2026 12:14
@simonschaufi
Copy link
Copy Markdown
Collaborator

simonschaufi commented Mar 10, 2026

Please fix the code style by running:

  • composer run-script local:contribute and
  • composer run-script docs.

And do a rebase, we only allow rebased commits.

@kitzberger kitzberger force-pushed the more-typoscript-conditions branch 3 times, most recently from 1cf64f9 to 32be102 Compare March 10, 2026 13:19
@simonschaufi
Copy link
Copy Markdown
Collaborator

I just noticed that the loginUser and usergroup is already handled in MigrateTypoScriptLoginUserAndUsergroupConditionsFractor.

What do you think? Should we remove that rule again and use yours or you remove these migrations and only handle the globalVar?

@kitzberger kitzberger force-pushed the more-typoscript-conditions branch from 32be102 to fadfb9a Compare March 10, 2026 13:50
@kitzberger kitzberger force-pushed the more-typoscript-conditions branch 2 times, most recently from 0cc7204 to 5467ef8 Compare March 10, 2026 16:06
Migrations for v10:

| Legacy condition                                | Migrated (v10 syntax)                                                   |
| ----------------------------------------------- | ----------------------------------------------------------------------- |
| `[globalVar = GP:key > 0]`                      | `[request && traverse(request.getQueryParams(), 'key') > 0]`            |
| `[globalVar = GP:tx_ext|field > 0]`             | `[request && traverse(request.getQueryParams(), 'tx_ext/field') > 0]`   |
| `[globalVar = GP:tx_ext|field !=]`              | `[request && traverse(request.getQueryParams(), 'tx_ext/field') != ""]` |
| `[globalVar = TSFE:id = {$page.home}]`          | `[page["uid"] == {$page.home}]`                                         |
| `[globalVar = TSFE:page|doktype = 3]`           | `[page["doktype"] == 3]`                                                |
| `[globalVar = TSFE:type = 1449874941]`          | `[getTSFE().type == 1449874941]`                                        |
| `[globalVar = TSFE:beUserLogin = 1]`            | `[getTSFE().beUserLogin == 1]`                                          |
| `[globalVar = LIT:1 = {$const}]`                | `[{$const} == 1]`                                                       |
| `[globalVar = LIT:1 != {$const}]`               | `[{$const} != 1]`                                                       |
| `[globalVar = BE_USER|user|admin = 1]`          | `[backend.user.isAdmin]`                                                |
| `[globalString = IENV:HTTP_HOST = example.org]` | `[request.getNormalizedParams().getHttpHost() == "example.org"]`        |
| `[globalString = TSFE:id=2111]`                 | `[page["uid"] == 2111]`                                                 |
| `[PIDinRootline = 89,130]`                      | `[89 in tree.rootLineIds || 130 in tree.rootLineIds]`                   |
| `[PIDinRootline = {$page.foo}]`                 | `[{$page.foo} in tree.rootLineIds]`                                     |
| `[PIDupinRootline = 89,130]`                    | `[89 in tree.rootLineParentIds || 130 in tree.rootLineParentIds]`       |
| `[applicationContext = Development]`            | `[applicationContext == "Development"]`                                 |
| `[applicationContext = Development*]`           | `[like(applicationContext, "Development*")]`                            |
| `[treeLevel = 1,3]`                             | `[tree.level in [1,3]]`                                                 |

And for v12:

| v10 syntax                           | Migrated (v12 syntax)                                                  |
| ------------------------------------ | ---------------------------------------------------------------------- |
| `[loginUser = *]`                    | `[frontend.user.isLoggedIn]`                                           |
| `[usergroup = *]`                    | `[frontend.user.userGroupIds !== [0, -1]]`                             |
| `[usergroup = 1,2]`                  | `[1 in frontend.user.userGroupIds || 2 in frontend.user.userGroupIds]` |
| `[globalVar = TSFE:type = 9818]`     | `[request.getPageArguments()?.getPageType() == '9818']`                |
| `[globalVar = TSFE:beUserLogin > 0]` | `[getTSFE()?.isBackendUserLoggedIn()]`                                 |
@kitzberger kitzberger force-pushed the more-typoscript-conditions branch from 5467ef8 to f8b6a19 Compare March 10, 2026 16:12
@simonschaufi
Copy link
Copy Markdown
Collaborator

It's really hard to review this when your stupid AI deletes existing fixture files and tries to number them differently. I wonder how you allowed your AI to do that. Copilot doesn't do these crazy things.

@kitzberger
Copy link
Copy Markdown
Contributor Author

I changed the filenames manually 🙈 To kinda group them. Does that make sense?

@simonschaufi
Copy link
Copy Markdown
Collaborator

ok, sorry to blame the AI :D I just wanted to check if all the tests are still there because usually git shows it as moved files but right now they are deleted and created.

@simonschaufi simonschaufi merged commit 8364080 into andreaswolf:main Mar 10, 2026
36 checks passed
@simonschaufi
Copy link
Copy Markdown
Collaborator

simonschaufi commented Mar 10, 2026

Thank you very much for your contributions! I really appreciate them! I've just created a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants