{{ form_label(form) }}

{% set defaultAttributes = {'attr': {'class': 'ui dropdown'}} %}
{% if app.request.query.has('error') %}
    {% set defaultAttributes = {'attr': {'class': 'ui dropdown is-invalid'}} %}
{% endif %}

{% if form.vars.choices is defined %}
    {{ form_widget(form, sylius_test_form_attribute('province-code')|sylius_merge_recursive(defaultAttributes)) }}
{% else %}
    {{ form_widget(form, sylius_test_form_attribute('province-name')) }}
{% endif %}

{% if app.request.query.has('error') %}
    <span class="invalid-feedback d-block">{{ app.request.query.get('error') }}</span>
{% endif %}
