mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-27 01:40:02 +01:00
35 lines
1.4 KiB
Twig
35 lines
1.4 KiB
Twig
{% set value = (value is null ? field.default : value) %}
|
|
{% set value = (value is same as(false) ? 0 : value) %}
|
|
|
|
<div class="form-field">
|
|
<label class="inline">
|
|
<span>
|
|
{% if field.help %}
|
|
<span class="tooltip" data-asTooltip-position="w" title="{{ field.help|e }}">{{ field.label }}</span>
|
|
{% else %}
|
|
{{ field.label }}
|
|
{% endif %}
|
|
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
|
|
</span>
|
|
</label>
|
|
<div class="switch-wrapper">
|
|
<div class="switch-toggle switch-grav switch-{{ field.options|length }}">
|
|
{% for key, text in field.options %}
|
|
{% set id = "toggle_" ~ field.name ~ key %}
|
|
<input type="radio"
|
|
value="{{ key }}"
|
|
id="{{ id }}"
|
|
name="{{ (scope ~ field.name)|fieldName }}"
|
|
{% if field.highlight is defined %}
|
|
class="{{ field.highlight == '' ~ key ? 'highlight' : '' }}"
|
|
{% endif %}
|
|
{% if '' ~ key == '' ~ value %}checked="checked" {% endif %}
|
|
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
|
|
/>
|
|
<label for="{{ id }}">{{ text }}</label>
|
|
{% endfor %}
|
|
<a></a>
|
|
</div>
|
|
</div>
|
|
</div>
|