Reputation: 618
How can I write this old style typoscript condition in Symfony Expression language?
[globalVar = GP:tx_myext_myplugin|bla > 0]
Perhaps something like
[request.getQueryParams()['tx_myext_myplugin[bla]'] > 0]
but that is obvious not working.
Upvotes: 1
Views: 401
Reputation: 75
The old style TypoScript condition [globalVar = GP:tx_myext_myplugin|bla > 0]
can be written with new condition syntax like [traverse(request.getQueryParams(), 'tx_myext_myplugin/bla') > 0]
.
Use traverse
in combination with getQueryParams
to avoid errors in case a key in the parameter array is not defined.
Upvotes: 0
Reputation: 3155
In case it is generating an error inside log then you need to check like this.. (i.e. Unable to get an item on a non-array)
[request.getQueryParams() and
request.getQueryParams()['tx_myext_myplugin'] and
request.getQueryParams()['tx_myext_myplugin']['bla'] > 0]
//Typoscript Code
[end]
&& can also be used as conditional operator here
Upvotes: 1