2

Before the update to TYPO3 9.5 I used the following condition syntax in setup.typoscript to enable sending an email to the sender using a checkbox in the frontend form:

[globalString = GP:tx_powermail_pi1|field|emailanabsender|0 = ]
    plugin.tx_powermail.settings.setup.sender.enable = 0
[else]
    plugin.tx_powermail.settings.setup.sender.enable = 1
[global]

What should the symfony condition syntax look like for this purpose?

According to my logic, the following should work, but it does not:

[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/emailanabsender/0')]
    plugin.tx_powermail.settings.setup.sender.enable = 1
[else]
    plugin.tx_powermail.settings.setup.sender.enable = 0
[global]

Can anyone help me with this?

boogie76
  • 41
  • 4

2 Answers2

1

I got It. The correct syntax for TYPO3 >= 9 is:

[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/emailanabsender/0') == '']
    plugin.tx_powermail.settings.setup.sender.enable = 0
[else]
    plugin.tx_powermail.settings.setup.sender.enable = 1
[global]

The docs says: "In case the path is not found in the array, an empty string is returned."

Data from the POST request can be read with request.getParsedBody(), and if the checkbox is unchecked, then it's missing in the POST-request.

boogie76
  • 41
  • 4
0

What about this:

[traverse(request.getQueryParams(), 'tx_powermail_pi1/field/emailanansender/0') > 0]
Alex Kellner
  • 1,263
  • 6
  • 11