#96561Site configuration value can't be evaluated in TypoScript if condition
Description
We have a site-config option to en-/disable something:
xxSomethingEnabled: true // or: xxSomethingEnabled: false
This value should be used in a TypoScript if-condition e.g. to include some JavaScript inside the header (here we’re just setting some text as example):
page {
headerData {
# test 1: this text string should be printed if the setting is enabled (true)
10 = TEXT
10.if.isTrue = site:xxSomethingEnabled
10.data = site:xxSomethingEnabled
10.wrap = From 10, the value of xxSomethingEnabled is: |
# test 2: this text string should be printed if the setting is disabled (false)
20 = TEXT
20.if {
value = 1
equals = site:xxSomethingEnabled
negate = 1
}
20.data = site:xxSomethingEnabled
20.wrap = From 20, the value of xxSomethingEnabled is: |
}
}
*Setting 1:*
The site-configuration holds xxSomethingEnabled: false
Given output:
From 10, the value of xxSomethingEnabled is:
From 20, the value of xxSomethingEnabled is:
Expected output:
Only “From 20, the value of xxSomethingEnabled is:1” should be printed, because the site option is false but it’s negated in TypoScript
*Setting 2:*
The site-configuration holds xxSomethingEnabled: true
Given output:
From 10, the value of xxSomethingEnabled is:1
From 20, the value of xxSomethingEnabled is:1
Expected output:
Only “From 10, the value of xxSomethingEnabled is:1” should be printed, because the site option is true
It’s clearly to see that the values from the site-configuration does not get properly evaluated in TypoScript expressions. Just by gut-feeling, it might be a reason of a falsely type conversion from site-config “false” (string) to 0 (integer), but TypoScript might expect a “0” (string), because the above script works like expected if we using a TypoScript constant set to 1 or 0 like {$test.xxSomethingEnabled}.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.