vendor/easycorp/easyadmin-bundle/src/Resources/views/crud/field/boolean.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
  3. {# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
  4. {% trans_default_domain 'EasyAdminBundle' %}
  5. {% if ea.crud.currentAction == 'detail' or not field.customOptions.get('renderAsSwitch') %}
  6.     {% set badge_is_hidden = ea.crud.currentAction == 'index'
  7.         and (
  8.             (field.value == true and field.customOptions.get('hideValueWhenTrue') == true)
  9.             or
  10.             (field.value == false and field.customOptions.get('hideValueWhenFalse') == true)
  11.         ) %}
  12.     {% if not badge_is_hidden %}
  13.         <span class="badge {{ field.value == true ? 'badge-boolean-true' : 'badge-boolean-false' }}">
  14.             {{ (field.value == true ? 'label.true' : 'label.false')|trans }}
  15.         </span>
  16.     {% endif %}
  17. {% else %}
  18.     <div class="form-check form-switch">
  19.         <input type="checkbox" class="form-check-input" id="{{ field.uniqueId }}" {{ field.value == true ? 'checked' }}
  20.             data-toggle-url="{{ field.customOptions.get('toggleUrl') }}"
  21.             {{ field.formTypeOption('disabled') == true ? 'disabled' }} autocomplete="off">
  22.         <label class="form-check-label" for="{{ field.uniqueId }}"></label>
  23.     </div>
  24. {% endif %}