kai-jacobsen/kontentblocks

View on GitHub
core/Fields/Definitions/templates/chosetaxonomy/default.twig

Summary

Maintainability
Test Coverage
{% extends Form.getLayout() %}
{% block fieldmarkup %}
    {% if error %}
        <p class="kb-warning">{{ error }}</p>
    {% else %}
        <select id='{{ Form.getInputFieldId() }}' name='{{ Form.getFieldName() }}'>
            {% if Field.getArg('empty', true) %}
                <option value='' name=''>{{ i18n.emptyTaxonomySelect }}</option>
            {% endif %}
            {% for term in terms %}
                {% set tfield = attribute(term, taxfield) %}
                <option {% if ( tfield == Field.getValue() ) %} selected="selected" {% endif %}
                        value='{{ attribute(term, taxfield) }}'>{{ term.name }}</option>
            {% endfor %}
        </select>
    {% endif %}
{% endblock %}