{{ if (field.containerClass) { }}<!-- Checkbox -->
<div class="{{= field.containerClass }}">
    <div class="{{ if (layout == 'form-horizontal') { }}row {{ } }}form-group{{ if (field.required) { }} required-control{{ } }}{{ if (field.asButton) { }} form-group-btn{{ } }}">{{ if (field.label) { }}
        <label class="{{ if (layout == 'form-horizontal') { }}col-form-label col-3{{ } }} {{= field.labelClass }}" for="{{= field.id }}">{{= field.label }}</label>{{ } }}{{ if (layout == 'form-horizontal') { }}<div class="col">{{ } }}{{ if (field.helpText && field.helpTextPlacement === "above") { }}
        <p class="form-text">{{= field.helpText }}</p>{{ } }}{{ _.each(field.checkboxes, function(checkbox, i){ var items = checkbox.split("|"); var last = items[items.length-1]; var checked = (last==="selected"||last==="select"|last==="check"); checkbox = items[0]; var value = ((items.length >= 3) || (items.length == 2) && !checked) ? items[1] : items[0]; var figure = ((items.length >= 4) || (items.length == 3 && !checked)) ? items[2] : false; }}
        <div{{ if (field.cssClass) { }} class="{{= field.cssClass }}{{ if (field.inline) { }} form-check-inline{{ } }}{{ if (field.asButton) { }} form-check-btn{{ } }}"{{ } }}{{ if(field.disabled) { }} disabled{{ } }}>
            <input type="checkbox" name="{{= field.id }}[]" id="{{= field.id+'_'+i }}" class="form-check-input{{ if (field.asButton) { }} btn-check{{ } }}" value="{{- value.replace(/(<([^>]+)>)/ig,'') }}" data-alias="{{= field.alias }}"{{ if(field.required){ }}data-required="true" {{ } }}{{ if(field.readOnly) { }}readOnly {{ } }}{{ if(field.disabled) {}}disabled {{ } }} {{ if(checked) { }}checked {{ } }}{{ _.each(field.customAttributes, function(attribute, i){ var attrs = attribute.split("|"); var attr = attrs[0]; var val = (attrs.length > 1) ? attrs[1] : attrs[0]; }}{{ if (attr) { }} {{- attr }}="{{- val }}"{{ } }}{{ }) }}><label for="{{= field.id+'_'+i }}" class="form-check-label{{ if (field.asButton) { }} btn btn-default{{ } }}">{{ if(figure) { }}
                <span class="figure">{{ if (figure.indexOf("http") == 0) { }}<img src="{{= figure }}" />{{ } else { }}<span class="{{= figure }}"> </span>{{ } }}</span>{{ } }}
                {{= checkbox }} </label>
        </div>{{ }); }}
        <span id="{{= field.id }}"></span>
        {{ if (field.helpText && field.helpTextPlacement === "below") { }}<p class="form-text">{{= field.helpText }}</p>{{ } }}{{ if (layout == 'form-horizontal') { }}</div>{{ } }}
    </div>
</div>
{{ } else { }}<!-- Checkbox -->
<div class="{{ if (layout == 'form-horizontal') { }}row {{ } }}form-group{{ if (field.required) { }} required-control{{ } }}{{ if (field.asButton) { }} form-group-btn{{ } }}">{{ if (field.label) { }}
    <label class="{{ if (layout == 'form-horizontal') { }}col-form-label col-3{{ } }} {{= field.labelClass }}" for="{{= field.id }}">{{= field.label }}</label>{{ } }}{{ if (layout == 'form-horizontal') { }}<div class="col">{{ } }}{{ if (field.helpText && field.helpTextPlacement === "above") { }}
    <p class="form-text">{{= field.helpText }}</p>{{ } }}{{ _.each(field.checkboxes, function(checkbox, i){ var items = checkbox.split("|"); var last = items[items.length-1]; var checked = (last==="selected"||last==="select"|last==="check"); checkbox = items[0]; var value = ((items.length >= 3) || (items.length == 2) && !checked) ? items[1] : items[0]; var figure = ((items.length >= 4) || (items.length == 3 && !checked)) ? items[2] : false; }}
    <div{{ if (field.cssClass) { }} class="{{= field.cssClass }}{{ if (field.inline) { }} form-check-inline{{ } }}{{ if (field.asButton) { }} form-check-btn{{ } }}"{{ } }}{{ if(field.disabled) { }} disabled{{ } }}>
        <input type="checkbox" name="{{= field.id }}[]" id="{{= field.id+'_'+i }}" class="form-check-input{{ if (field.asButton) { }} btn-check{{ } }}" value="{{- value.replace(/(<([^>]+)>)/ig,'') }}" data-alias="{{= field.alias }}"{{ if(field.required){ }}data-required="true" {{ } }}{{ if(field.readOnly) { }}readOnly {{ } }}{{ if(field.disabled) {}}disabled {{ } }} {{ if(checked) { }}checked {{ } }}{{ _.each(field.customAttributes, function(attribute, i){ var attrs = attribute.split("|"); var attr = attrs[0]; var val = (attrs.length > 1) ? attrs[1] : attrs[0]; }}{{ if (attr) { }} {{- attr }}="{{- val }}"{{ } }}{{ }) }}><label class="form-check-label{{ if (field.asButton) { }} btn btn-default{{ } }}" for="{{= field.id+'_'+i }}">{{ if(figure) { }}
            <span class="figure">{{ if (figure.indexOf("http") == 0) { }}<img src="{{= figure }}" />{{ } else { }}<span class="{{= figure }}"> </span>{{ } }}</span>{{ } }}
            {{= checkbox }} </label>
    </div>{{ }); }}
    <span id="{{= field.id }}"></span>
    {{ if (field.helpText && field.helpTextPlacement === "below") { }}<p class="form-text">{{= field.helpText }}</p>{{ } }}{{ if (layout == 'form-horizontal') { }}</div>{{ } }}
</div>
{{ } }}