{% assets %}
    {% block stylesheets %}
    {% endblock %}

    {% block javascript %}
    {% endblock %}
{% endassets -%}

{% assets in 'footer' %}
    {% block javascript_footer %}
    {% endblock %}
{% endassets -%}

{% set name = (name ?? field.name) -%}
{% set default_value = (default_value ?? field.default) -%}
{% set current_value = (current_value ?? value) %}
{% set has_value = current_value is not null %}
{% set value = has_value ? current_value : default_value -%}

{% block field %}
    {% if not field.isset or value is not null %}
    {% block contents %}
        {% block group %}
            {% block input %}
                <input
                        {# required attribute structures #}
                        name="{{ (scope ~ name)|fieldName }}"
                        value="{{ value|join(', ') }}"
                        {# global attribute structures #}
                        {% block global_attributes %}
                            {% if field.class is defined %} class="{{ field.class }}" {% endif %}
                            {% if field.id is defined %} id="{{ field.id }}" {% endif %}
                            {% if field.style is defined %} style="{{ field.style }}" {% endif %}
                            {% if field.title is defined %} title="{{ field.title }}" {% endif %}
                            {% if field.override_target is defined %} data-override-target="{{ field.override_target|e('html_attr') }}" {% endif %}
                            aria-label="{{ (scope ~ name)|replace({'.': ' '})|title|trim }}"
                        {% endblock %}
                        />

                {% block reset_field -%}
                    {% if field.reset_field is not defined or field.reset_field in ['on', 'true', 1] %}
                        <span class="g-reset-field" data-g-reset-field="{{ (scope ~ name)|fieldName }}"><i class="fa  fa-fw fa-times-circle" aria-hidden="true"></i></span>
                    {% endif %}
                {%- endblock %}
            {% endblock %}
        {% endblock %}
    {% endblock %}
    {% endif %}
{% endblock %}
