{% from "_includes/forms" import textareaField %}
{{ textareaField({
id: name,
name: name,
label: 'Checkbox Options',
instructions: 'JSON format. Twig code is allowed encouraged :)',
rows: 7,
class: 'code',
value: settings.json
}) }}
{% verbatim %}
'Copy & Paste' one of the following examples into the textarea above.
{ "value":"jim" , "label":"Jim Beam" }, { "value":"jack" , "label":"Jack Daniels" , "default":true }, { "value":"mark" , "label":"Maker's Mark" }, { "value":"rebel" , "label":"Rebel Yell" , "default":true }
{% for entry in craft.entries.limit(null).order('title') %} { "value":"{{ entry.id }}" , "label":"{{ entry | raw }}" {% if entry.uri == '__home__' %} , "default":true{% endif %} }{% if not loop.last %},{% endif %} {% endfor %}
{% include '_dynamicfields/sections' ignore missing %}
Example code for /craft/templates/_dynamicfields/sections.html
{% for section in craft.sections.getAllSections() %} { "value":"{{ section.id }}" , "label":"{{ section | raw }}" } {% if not loop.last %},{% endif %} {% endfor %}{% endverbatim %}