Created
June 18, 2020 10:07
-
-
Save terryupton/24ce1e6fc16d27c0e899866f7d8cc6ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set checkboxFieldClasses = | |
"form-checkbox w-5 h-5 text-green-500" %} | |
{% if field.type == "checkbox_group" %} | |
{% set fieldClass = checkboxFieldClasses %} | |
<div class="mb-2"> | |
{% include 'forms/_default/_partials/_label.twig' %} | |
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }} | |
{% for index, option in field.options %} | |
<div class="px-3 mb-1"> | |
<input type="checkbox" | |
name="{{ field.handle }}[]" | |
value="{{ option.value }}" | |
id="{{ field.idAttribute }}-{{ index }}" | |
class="{{ fieldClass }} {{ field.hasErrors ? " border-red-500" }}" | |
{{ option.checked ? "checked" : "" }} | |
/> | |
<label class="ml-1 text-sm" for="{{ field.idAttribute }}-{{ index }}"> | |
{{ option.label|t|raw }} | |
</label> | |
</div> | |
{% endfor %} | |
{{ field.oneLine ? "</div>"|raw }} | |
{{ field.renderInstructions() }} | |
{% include 'forms/_default/_partials/_error.twig' %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment