{# This file is part of the Sonata package. (c) Thomas Rabaix For the full copyright and license information, please view the LICENSE file that was distributed with this source code. #} {% extends admin.getTemplate('base_list_field') %} {% block field %} {% spaceless %} {% if field_description.options.choices is defined %} {% if field_description.options.multiple is defined and field_description.options.multiple==true and value is iterable %} {% set result = '' %} {% set delimiter = field_description.options.delimiter|default(', ') %} {% for val in value %} {% if result is not empty %} {% set result = result ~ delimiter %} {% endif %} {% if field_description.options.choices[val] is defined %} {% if field_description.options.catalogue is not defined %} {% set result = result ~ field_description.options.choices[val] %} {% else %} {% set result = result ~ field_description.options.choices[val]|trans({}, field_description.options.catalogue) %} {% endif %} {% else %} {% set result = result ~ val %} {% endif %} {% endfor %} {% set value = result %} {% elseif value in field_description.options.choices|keys %} {% if field_description.options.catalogue is not defined %} {% set value = field_description.options.choices[value] %} {% else %} {% set value = field_description.options.choices[value]|trans({}, field_description.options.catalogue) %} {% endif %} {% endif %} {% endif %} {{ value }} {% endspaceless %} {% endblock %}