Appearance
Custom Modules
Templating
Custom modules support templating.
A special custom module must exists called echo
defined as:
javascript
{
"value": {
"type": "text",
"label": "value"
}
}
With the only template:
html
%value%
All variables %name%
will be replaced before template rendering.
Templating engines
Twig
Only the Desktop template
is used for all platforms.
This is detected when the template start with {# twig #}
.
The specific context is:
- page, the rendered page.
- custom, the custom module definition.
- configuration, the specific configuration (e.g. the user specified values).
For example, the custom module:
javascript
{
"title": {"type": "text", "label": "T\u00edtulo"},
"range": {"type": "text", "label": "Up to"}
}
With template:
html
{# twig #}
<h1>{{ configuration.title }}</h1>
<ul>
{% for i in 1 .. configuration.range %}
<li>Item number {{ i }}.</li>
{% endfor %}
</ul>
Produce, with values "Foo314" and "5" the output:
text
Foo314
* Item number 1.
* Item number 2.
* Item number 3.
* Item number 4.
* Item number 5.