Using site configuration in conditions
Site configuration may be used in all conditions that use Symfony expression language via the EXT:core/Classes/ExpressionLanguage/FunctionsProvider/Typo3ConditionFunctionsProvider.php (GitHub) class - at the moment, this means in EXT:form variants and TypoScript conditions.
Two objects are available:
site
- You can access the properties of the top level site configuration.
site
Language - Access the configuration of the current site language.
TypoScript examples
The identifier of the site name is evaluated:
[site("identifier") == "someIdentifier"]
page.30.value = foo
[GLOBAL]
Copied!
A custom field is evaluated:
[site("configuration")["custom_field"] == "compareValue"]
page.35.value = abc
[GLOBAL]
Copied!
site
is equivalent to a call of "methodName" on the current site object.
You can take a look at \TYPO3\
for accessible methods.
Property of the current site language is evaluated:
[siteLanguage("locale") == "de_CH.UTF-8"]
page.40.value = bar
[GLOBAL]
Copied!
Example for EXT:form
Translate options via site
condition:
renderables:
- type: Page
identifier: page-1
label: DE
renderingOptions:
previousButtonLabel: 'zurück'
nextButtonLabel: 'weiter'
variants:
- identifier: language-variant-1
condition: 'siteLanguage("locale") == en_US.UTF-8'
label: EN
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'