{% extends default ? "partials/field.html.twig" : 'forms/' ~ layout|default('field') ~ '.html.twig' %}

{% macro pend(item) %}
    {% if item.type == "text" %}
        <span class="input-group-addon">{{ item.text|e }}</span>
    {% elseif item.type == "list" %}
        {% if item.options %}
            {% include 'forms/fields/select/selectize.html.twig' with {'field.options': item.options} %}
        {% endif %}
    {% elseif item.type == "button" %}
        <span class="input-group-btn">
            {% include 'forms/fields/button' %}
        </span>
    {% elseif item.type == "actions" %}
    {% endif %}
{% endmacro %}

{% import _self as macro %}

{% block group %}
    <div class="input-group
        {% if field.prepend -%} prepend
        {% endif %}
        {% if field.append -%} append
        {% endif %}
    ">


        {% if field.prepend %}
            {{ macro.pend(field.prepend) }}
        {% endif %}
        {% block input %}
        {% endblock %}
        {% if field.append %}
            {{ macro.pend(field.append) }}
        {% endif %}
        {% block reset_field %}{{ parent() }}{% endblock %}
    </div>
{% endblock %}
