Checkboxes
Checkboxes allow publishers to choose multiple items from a list.
note
The following examples use a field named checkboxes_field
. This should be replaced with your field name.
Single Variable
You can use a single variable for Checkboxes to render a comma-separated list of the labels.
- Twig
- Blade
{{ entry.checkboxes_field }}
{% for value, label in entry.checkboxes_field.options %}
{{ label }} - {{ value }}
{% endfor %}
{% for value, label in entry.checkboxes_field.selected %}
{{ label }} - {{ value }}
{% endfor %}
{{ $entry->checkboxes_field }}
@foreach($entry->checkboxes_field->options as $value => $label)
{{ $label }} - {{ $value }}
@endforeach
@foreach($entry->checkboxes_field->selected as $value => $label)
{{ $label }} - {{ $value }}
@endforeach
Parameters
Limit
- Twig
- Blade
{{ entry.checkboxes_field.parameters({limit: 1}) }}
{{ $entry->checkboxes_field->parameters(['limit' => 1]) }}
Markup
- Twig
- Blade
{{ entry.checkboxes_field.parameters({markup: 'ul'}) }}
{{ $entry->checkboxes_field->parameters(['markup' => 'ul']) }}
info
See the ExpressionEngine Documentation for more information on the Checkboxes fieldtype