You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
6.5KB

  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% use '@EasyAdmin/crud/form_theme.html.twig' %}
  3. {% block gallery_manager_row %}
  4. {{ block('collection_row') }}
  5. {% endblock gallery_manager_row %}
  6. {% block gallery_manager_widget %}
  7. {{ block('collection_widget') }}
  8. {% endblock gallery_manager_widget %}
  9. {% block collection_row %}
  10. {% if prototype is defined and not prototype.rendered %}
  11. {% set row_attr = row_attr|merge({ 'data-prototype': form_row(prototype) }) %}
  12. {% endif %}
  13. {% set row_attr = row_attr|merge({
  14. 'data-entry-is-complex': form.vars.ea_crud_form.ea_field and form.vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ? 'true' : 'false',
  15. 'data-allow-add': allow_add ? 'true' : 'false',
  16. 'data-allow-delete': allow_delete ? 'true' : 'false',
  17. 'data-num-items': form.children|length,
  18. 'data-form-type-name-placeholder': prototype is defined ? prototype.vars.name : '',
  19. }) %}
  20. {{ block('form_row') }}
  21. {% endblock collection_row %}
  22. {% block collection_widget %}
  23. {{ block('form_widget') }}
  24. {% if allow_add|default(false) %}
  25. <button type="button" class="btn btn-link field-collection-add">
  26. <i class="fa fa-plus pr-1"></i>
  27. {{ 'action.add_new_item'|trans({}, 'EasyAdminBundle') }}
  28. </button>
  29. {% endif %}
  30. {% endblock collection_widget %}
  31. {% block collection_entry_widget %}
  32. {% set is_complex = form_parent(form).vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ?? false %}
  33. <div class="field-collection-item {{ is_complex ? 'field-collection-item-complex' }}">
  34. {{ form_widget(form) }}
  35. {% if form_parent(form).vars.allow_delete|default(false) %}
  36. <button type="button" class="btn btn-link field-collection-delete"
  37. title="{{ 'action.remove_item'|trans({}, 'EasyAdminBundle') }}">
  38. <i class="fas fa-times"></i>
  39. </button>
  40. {% endif %}
  41. </div>
  42. {% endblock collection_entry_widget %}
  43. {% block file_manager_image_row %}
  44. {{ form_widget(form) }}
  45. {% endblock file_manager_image_row %}
  46. {% block file_manager_legend_row %}
  47. {{ form_widget(form) }}
  48. {% endblock file_manager_legend_row %}
  49. {% block file_manager_position_row %}
  50. {{ form_widget(form) }}
  51. {% endblock file_manager_position_row %}
  52. {% block file_manager_widget %}
  53. <div class="lc-filemanager row">
  54. <div class="col-md-3 col-xs-12 form-group">
  55. <div class="lc-filemenager-preview card">
  56. <div class="no-image">
  57. <i class="fa fa-image"></i>
  58. </div>
  59. <img src="{{ form.path.vars.value }}" id="{{ form.path.vars.id }}_preview" alt="" class="card-img-top">
  60. </div>
  61. </div>
  62. <div class="col-12">
  63. <div class="input-group">
  64. <div class="input-group-prepend">
  65. {% if form.parent.vars['row_attr']['data-sortable'] is defined %}
  66. <button type="button" class="btn btn-success lc-btn-sortable" data-toggle="tooltip" title="Trier les images">
  67. <i class="fa fa-arrows-alt"></i>
  68. </button>
  69. {% endif %}
  70. <button type="button" class="btn btn-primary lc-filemanager-open" data-id="{{ form.path.vars.id }}" data-toggle="tooltip" title="Sélectionner un fichier"
  71. data-target="{{ path('file_manager', {module:1, conf:'default'})|raw }}">
  72. <i class="fa fa-folder-open"></i>
  73. </button>
  74. </div>
  75. {{ form_widget(form.legend) }}
  76. <div class="input-group-append">
  77. <button type="button" class="btn btn-danger lc-filemanager-delete" data-toggle="tooltip" title="Supprimer l'image"
  78. data-id="{{ form.path.vars.id }}">
  79. <i class="fa fa-trash"></i>
  80. </button>
  81. </div>
  82. {{ form_rest(form) }}
  83. </div>
  84. </div>
  85. </div>
  86. {% endblock file_manager_widget %}
  87. {% block checkbox_radio_label -%}
  88. {#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
  89. {%- if widget is defined -%}
  90. {% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class or 'switch-custom' in parent_label_class) %}
  91. {% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class or 'switch-custom' in label_attr.class) %}
  92. {%- if is_parent_custom or is_custom -%}
  93. {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
  94. {%- else %}
  95. {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}
  96. {%- endif %}
  97. {%- if not compound -%}
  98. {% set label_attr = label_attr|merge({'for': id}) %}
  99. {%- endif -%}
  100. {%- if required -%}
  101. {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%}
  102. {%- endif -%}
  103. {%- if parent_label_class is defined -%}
  104. {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': ''})|trim}) -%}
  105. {%- endif -%}
  106. {%- if label is not same as(false) and label is empty -%}
  107. {%- if label_format is not empty -%}
  108. {%- set label = label_format|replace({
  109. '%name%': name,
  110. '%id%': id,
  111. }) -%}
  112. {%- else -%}
  113. {%- set label = name|humanize -%}
  114. {%- endif -%}
  115. {%- endif -%}
  116. <label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
  117. {{ widget|raw }}
  118. <span class="checkmark"></span>
  119. {# {% if translation_domain == 'lcshop' %}
  120. {{ name|lc_trad(easyadmin['entity']['name'], 'field') }}
  121. {% else %}#}
  122. {{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain))|raw -}}
  123. {#{% endif %}#}
  124. {{- form_errors(form) -}}
  125. </label>
  126. {%- endif -%}
  127. {%- endblock checkbox_radio_label %}