display_boolean.html.twig 710 B

1234567891011121314151617181920212223242526
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {%- spaceless %}
  8. {% if value %}
  9. {% set text = 'label_type_yes'|trans({}, 'SonataAdminBundle') %}
  10. {% else %}
  11. {% set text = 'label_type_no'|trans({}, 'SonataAdminBundle') %}
  12. {% endif %}
  13. {% if field_description.options.inverse|default(false) ? not value : value %}
  14. {% set class = 'label-success' %}
  15. {% else %}
  16. {% set class = 'label-danger' %}
  17. {% endif %}
  18. <span class="label {{ class }}">{{ text }}</span>
  19. {% endspaceless -%}