3. Variable resolvers¶
Target group: Integrators, Developers
Table of Contents
Variables¶
You can use variables in the common process parameters, such as summary
or initiator
, and in the process table fields.
Variables look like: {__variableName}
or
{__variableName.subKey}
− in curly brackets with a double underscore
at the beginning.
Example:
finishers:
-
identifier: JobRouterStartInstance
options:
handle: 'start_website_contact'
summary: '{__LLL:EXT:your_ext/Resources/Private/Language/forms.xlf:demo.summary} ({__language.navigationTitle})'
initiator: '{__correlationId}'
processtable:
name: '{preName} {lastName}'
company: '{company}'
email_address: '{email}'
phone_number: '{phone}'
message: '{message}'
from_website: '{__language.base}'
Hint
You can build own variable resolvers. Have a look in the section Writing own variable resolvers.
Correlation id¶
The correlation ID is generated from the form identifier and a unique key to identify associated transfers – as you can start multiple instances from one form and transmit data to a JobData table. The correlation ID is stored in a column in the transfer tables together with the form data. This is useful if you want to check the data from the instance against the original data from the form.
The correlation ID looks like this: form_demo-20_63fca23b1accb
where form
indicates the ID is generated by a from finisher, demo-20
is the form
identifier with the content element uid of the form plugin and 63fca23b1accb
is the unique key.
Use the {__correlationId}
variable to add the correlation ID.
Note
The correlation ID is the same for every JobRouter form finisher in a form instance.
Tip
The correlation id can be used to set the initiator for a process instance start (if the initiator is not used to assign a step to a JobRouter® user). This way the correlation id is easy to spot in the step overview.
Localisation labels¶
Values can be localised with the help of the localisation labels known from
various parts in TYPO3. The variable starts with {__LLL:
and holds
the path to the translation file and the according key, e.g.
{__LLL:EXT:your_ext/Resources/Private/Language/locallang.xlf:your.label}
.
If the label is not found and therefore cannot be translated the value is untouched.
You can use multiple localisation labels in one form value.
Language information¶
The language information defined in the Site Configuration can be used, namely:
- {__language.base}
The base URL for the language, e.g.
https://example.org/en/
.- {__language.direction}
The language direction:
ltr
(left to right) orrtl
(right to left).- {__language.flagIdentifier}
The defined TYPO3 flag identifier used in TYPO3’s backend, e.g.
flags-gb
.- {__language.hreflang}
Language tag for the language defined by RFC 1766 / 3066 for
lang
hreflang
attributes, e.g.en-gb
.- {__language.languageId}
The language ID defined in the TYPO3 installation. It is the uid in the
sys_language
table.- {__language.locale}
The used locale, e.g.
en_GB.UTF-8
.- {__language.navigationTitle}
The navigation title defined in the site configuration, used as label within language menus, e.g.
English
.- {__language.title}
The title defined in the site configuration, e.g.
English
.- {__language.twoLetterIsoCode}
The ISO-639-1 language ISO code, e.g.
en
.- {__language.typo3Language}
default
for English, otherwise one of TYPO3’s internal language keys.
Multiple language variables can be used in one form value.
JobRouter language information¶
Sometimes it is necessary to use not the language code of the page in your form
but instead the language string JobRouter® uses (e.g. german
instead of
de
). This can be useful for sending localised emails from the process in the
relevant language.
Use the {__jobRouterLanguage}
variable for that. The following languages
are supported by JobRouter® in recent version:
ISO 639-1 code |
JobRouter® language |
---|---|
ar |
arabic |
cs |
czech |
da |
danish |
de |
german |
en |
english |
es |
spanish |
fi |
finnish |
fr |
french |
hr |
croatian |
hu |
hungarian |
it |
italian |
ja |
japanese |
lt |
lithuanian |
nl |
dutch |
pl |
polish |
pt |
portuguese |
ro |
romanian |
ru |
russian |
sk |
slovak |
sl |
slovenian |
sr |
serbian |
tr |
turkish |
zh |
chinese |
If the language is not available, an empty string is returned by the variable resolver.
Page properties¶
The properties of the page where the form is located can be retrieved. The
variable starts with __page.
. Any existing page property, such as uid or
title, can be used, for example: {__page.title}
.
If a page property is not present, the variable is used unchanged.