{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% extends get_admin_template('base_list_field', admin.code) %}

{% set is_editable = field_description.option('editable', false) and admin.hasAccess('edit', object) %}
{% set x_editable_type = field_description.type|sonata_xeditable_type %}

{% block field_span_attributes %}
    {% if is_editable and x_editable_type %}
        {% apply spaceless %}
            {{ parent() }}
            data-source="[{value: 0, text: '{%- trans from 'SonataAdminBundle' %}label_type_no{% endtrans -%}'},{value: 1, text: '{%- trans from 'SonataAdminBundle' %}label_type_yes{% endtrans -%}'}]"
        {% endapply %}
    {% endif %}
{% endblock %}

{% block field %}
    {%- include '@SonataAdmin/CRUD/display_boolean.html.twig' with {
        value: value,
        inverse: field_description.option('inverse'),
    } only -%}
{% endblock %}
