12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- {#
- 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 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
- {% 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 %}
- {% if field_description.options.safe %}
- {{ value|raw }}
- {% else %}
- {{ value }}
- {% endif %}
- {% endspaceless %}
- {% endblock %}
|