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.

form_theme.html.twig 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% use '@EasyAdmin/crud/form_theme.html.twig' %}
  3. {% block form_label -%}
  4. {% if label is not same as(false) -%}
  5. {%- if compound is defined and compound -%}
  6. {%- set element = 'legend' -%}
  7. {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%}
  8. {%- else -%}
  9. {%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-label')|trim}) -%}
  10. {%- endif -%}
  11. {{ parent() }}
  12. {%- endif -%}
  13. {%- endblock form_label %}
  14. {% block gallery_manager_row %}
  15. {{ block('collection_row') }}
  16. {% endblock gallery_manager_row %}
  17. {% block gallery_manager_widget %}
  18. {{ block('collection_widget') }}
  19. {% endblock gallery_manager_widget %}
  20. {% block collection_row %}
  21. {% if prototype is defined and not prototype.rendered %}
  22. {% set row_attr = row_attr|merge({ 'data-prototype': form_row(prototype) }) %}
  23. {% endif %}
  24. {% set row_attr = row_attr|merge({
  25. 'data-entry-is-complex': form.vars.ea_crud_form.ea_field and form.vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ? 'true' : 'false',
  26. 'data-allow-add': allow_add ? 'true' : 'false',
  27. 'data-allow-delete': allow_delete ? 'true' : 'false',
  28. 'data-num-items': form.children|length,
  29. 'data-form-type-name-placeholder': prototype is defined ? prototype.vars.name : '',
  30. }) %}
  31. {{ block('form_row') }}
  32. {% endblock collection_row %}
  33. {% block collection_widget %}
  34. {{ block('form_widget') }}
  35. {% if allow_add|default(false) %}
  36. <button type="button" class="btn btn-link field-collection-add">
  37. <i class="fa fa-plus pr-1"></i>
  38. {{ 'action.add_new_item'|trans({}, 'EasyAdminBundle') }}
  39. </button>
  40. {% endif %}
  41. {% endblock collection_widget %}
  42. {% block collection_entry_widget %}
  43. {% set is_complex = form_parent(form).vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ?? false %}
  44. <div class="field-collection-item {{ is_complex ? 'field-collection-item-complex' }}">
  45. {{ form_widget(form) }}
  46. {% if form_parent(form).vars.allow_delete|default(false) %}
  47. <button type="button" class="btn btn-link field-collection-delete"
  48. title="{{ 'action.remove_item'|trans({}, 'EasyAdminBundle') }}">
  49. <i class="fas fa-times"></i>
  50. </button>
  51. {% endif %}
  52. </div>
  53. {% endblock collection_entry_widget %}
  54. {% block file_manager_image_row %}
  55. {{ form_widget(form) }}
  56. {% endblock file_manager_image_row %}
  57. {% block file_manager_legend_row %}
  58. {{ form_widget(form) }}
  59. {% endblock file_manager_legend_row %}
  60. {% block file_manager_position_row %}
  61. {{ form_widget(form) }}
  62. {% endblock file_manager_position_row %}
  63. {% block file_manager_widget %}
  64. <div class="lc-filemanager col-xs-12">
  65. <div class="col-md-6 col-xs-12 nopadding" style="padding: 0px;">
  66. <img style="width: 200px; height: 150px; object-fit: contain; background: #ddd; " src="{{ form.path.vars.value }}" class="lc-filemenager-preview" id="{{ form.path.vars.id }}_preview" alt="">
  67. </div>
  68. <div class="input-group">
  69. {{ form_widget(form) }}
  70. <div class="input-group-append">
  71. <button type="button" class="btn btn-sm lc-filemanager-open" data-id="{{ form.path.vars.id }}"
  72. data-target="{{ path('file_manager', {module:1, conf:'default'})|raw }}">
  73. <i class="fa fa-folder-open-o"></i>
  74. </button>
  75. {% if value %}
  76. <button type="button" class="btn btn-sm lc-filemanager-delete" data-id="{{ form.path.vars.id }}">
  77. <i class="fa fa-trash-o"></i>
  78. </button>
  79. {% endif %}
  80. {% if form.parent.vars['row_attr']['data-sortable'] is defined %}
  81. <button type="button" class="btn btn-sm lc-btn-sortable" >
  82. <i class="fa fa-arrows"></i>
  83. </button>
  84. {% endif %}
  85. </div>
  86. </div>
  87. </div>
  88. {% endblock file_manager_widget %}