RainLab.Pages: Custom page field cheatsheet
16
This is a short cheatsheet for Custom Page Fields:
String
{variable name="variableName" tab="tabName" label="fieldLabel" type="text"}{/variable}
Use in twig:
{{ variableName }}
Textarea
{variable name="variableName" label="fieldLabel" tab="tabName" type="textarea"}{/variable}
Use in twig:
{{ variableName }}
Checkbox
{variable name="variableName" tab="tabName" label="fieldLabel" type="checkbox"}{/variable}
Use in twig:
{% if variableName %}
Mediafinder
{variable name="variableName" tab="tabName" label="fieldLabel" type="mediafinder"}{/variable}
Use in twig:
{{ variableName | media }}
Dropdown
{variable name="variableName" tab="tabName" label="fieldLabel"
options="Option1|Option2|Option3" type="dropdown"}{/variable}
or
{variable name="variableName" tab="tabName" label="fieldLabel"
options="one:Option1|two:Option2|three:Option3" type="dropdown"}{/variable}
Use in twig:
{% if variableName == 2 %} {# This means Option2 is selected. #}
or
{% if variableName == two %} {# This means Option2 is selected (with keys). #}
Repeater
{repeater name="repeaterName" prompt="Add an item." tab="tabName"}
[...]
{/repeater}
Use in twig:
{% for repeaterItem in repeaterName %}
[...]
{% endfor %}
There are no comments yet
Be the first one to comment