Search code examples
typo3typoscripttypo3-9.xtypo3-10.x

Migrate combined typoscript conditions to symfony expression language in TYPO3 10


The following combined typoscript conditions is working in TYPO3 9 but not with TYPO3 10 anymore:

[loginUser('*')] && [getTSFE() && getTSFE().page['uid'] == {$pid.login}]
    page.bodyTag = <body class="logged-in">
[global]

In TYPO3 10 I get this error:

Expression could not be parsed. - {"expression":"loginUser('*')] && [getTSFE() && getTSFE().page['uid'] == 20"}

How can I combine conditions in TYPO3 10?


Solution

  • The combined TypoScript needs to be inside 1 set of brackets. So: [loginUser('*') && getTSFE() && getTSFE().page['uid'] == {$pid.login}].

    The reason why it worked in TYPO3 9 is because the old conditions worked like [...] && [...] instead of [... && ...] and they even worked when combining the old syntax with the new symfony expressions. In TYPO3 10 the old conditions have been removed including the syntax, so it doesn't work like that anymore.