|
- {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
- {% use '@EasyAdmin/crud/form_theme.html.twig' %}
-
- {% block form_row %}
- {% set row_attr = row_attr|merge({
- class: row_attr.class|default('') ~ ' form-group'
- }) %}
-
- <div {% with { attr: row_attr } %}{{ block('attributes') }}{% endwith %}>
- {{- form_label(form) -}}
- <div class="form-widget">
- {% set has_prepend_html = ea.field.prepend_html|default(null) is not null %}
- {% set has_append_html = ea.field.append_html|default(null) is not null %}
- {% set has_input_groups = has_prepend_html or has_append_html %}
-
- {% if has_input_groups %}<div class="input-group">{% endif %}
- {% if has_prepend_html %}
- <div class="input-group-prepend">
- <span class="input-group-text">{{ ea.field.prepend_html|raw }}</span>
- </div>
- {% endif %}
-
- {{ form_widget(form) }}
-
- {% if has_append_html %}
- <div class="input-group-append">
- <span class="input-group-text">{{ ea.field.append_html|raw }}</span>
- </div>
- {% endif %}
- {% if has_input_groups %}</div>{% endif %}
-
- {% set nullable_fields_fqcn = [
- 'EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField',
- 'EasyCorp\Bundle\EasyAdminBundle\Field\DateField',
- 'EasyCorp\Bundle\EasyAdminBundle\Field\TimeField',
- ] %}
- {% if form.vars.ea_crud_form.ea_field.fieldFqcn|default(false) in nullable_fields_fqcn and ea.field.nullable|default(false) %}
- <div class="nullable-control">
- <label>
- <input type="checkbox" {% if data is null %}checked="checked"{% endif %}>
- {{ 'label.nullable_field'|trans({}, 'EasyAdminBundle')}}
- </label>
- </div>
- {% endif %}
-
- {% set help_message = name|lc_trans_admin_help(form.parent.vars.data) %}
- {% if help_message != '' %}
- <small class="form-help">{{ help_message }}</small>
- {% endif %}
-
- {{- form_errors(form) -}}
- </div>
- </div>
- {% endblock form_row %}
-
- {% block form_label -%}
- {% if label is same as(false) -%}
- <label>{# the empty <label> is needed to not break the form design #}</label>
- {%- else -%}
- {%- if compound is defined and compound -%}
- {%- set element = 'legend' -%}
- {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%}
- {%- else -%}
- {%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%}
- {%- endif -%}
- {% if required -%}
- {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}
- {%- endif -%}
- {% if label is empty -%}
- {%- if label_format is not empty -%}
- {% set label = label_format|replace({
- '%name%': name,
- '%id%': id,
- }) %}
- {%- else -%}
- {# {% set label = name|humanize %} #}
- {%- endif -%}
- {%- endif -%}
-
- {# <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (translation_domain is same as(false)) ? label : label|lower|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</{{ element|default('label') }}> #}
- <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|lc_trans_admin_field(form.parent.vars.data) }}</{{ element|default('label') }}>
-
- {%- endif -%}
- {%- endblock form_label %}
-
- {% block gallery_manager_row %}
- {{ block('collection_row') }}
- {% endblock gallery_manager_row %}
-
- {% block gallery_manager_widget %}
- {{ block('collection_widget') }}
- {% endblock gallery_manager_widget %}
-
- {% block collection_row %}
- {% if prototype is defined and not prototype.rendered %}
- {% set row_attr = row_attr|merge({ 'data-prototype': form_row(prototype) }) %}
- {% endif %}
-
- {% set row_attr = row_attr|merge({
- 'data-entry-is-complex': form.vars.ea_crud_form.ea_field and form.vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ? 'true' : 'false',
- 'data-allow-add': allow_add ? 'true' : 'false',
- 'data-allow-delete': allow_delete ? 'true' : 'false',
- 'data-num-items': form.children|length,
- 'data-form-type-name-placeholder': prototype is defined ? prototype.vars.name : '',
- }) %}
-
- {{ block('form_row') }}
- {% endblock collection_row %}
-
- {% block collection_widget %}
- {{ block('form_widget') }}
- {% if allow_add|default(false) %}
- <button type="button" class="btn btn-link field-collection-add">
- <i class="fa fa-plus pr-1"></i>
- {{ 'action.add_new_item'|trans({}, 'EasyAdminBundle') }}
- </button>
- {% endif %}
- {% endblock collection_widget %}
-
- {% block collection_entry_widget %}
- {% set is_complex = form_parent(form).vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ?? false %}
-
- <div class="field-collection-item {{ is_complex ? 'field-collection-item-complex' }}">
- {{ form_widget(form) }}
-
- {% if form_parent(form).vars.allow_delete|default(false) %}
- <button type="button" class="btn btn-link field-collection-delete"
- title="{{ 'action.remove_item'|trans({}, 'EasyAdminBundle') }}">
- <i class="fas fa-times"></i>
- </button>
- {% endif %}
- </div>
- {% endblock collection_entry_widget %}
-
- {% block file_manager_image_row %}
- {{ form_widget(form) }}
- {% endblock file_manager_image_row %}
-
- {% block file_manager_legend_row %}
- {{ form_widget(form) }}
- {% endblock file_manager_legend_row %}
-
- {% block file_manager_position_row %}
- {{ form_widget(form) }}
- {% endblock file_manager_position_row %}
-
-
- {% block file_manager_widget %}
-
- <div class="lc-filemanager row">
- <div class="col-md-3 col-xs-12 form-group">
- <div class="lc-filemenager-preview card">
- <div class="no-image">
- <i class="fa fa-image"></i>
- </div>
- <img src="{{ form.path.vars.value }}" id="{{ form.path.vars.id }}_preview" alt="" class="card-img-top">
- </div>
- </div>
- <div class="col-12">
- <div class="input-group">
- <div class="input-group-prepend">
- {% if form.parent.vars['row_attr']['data-sortable'] is defined %}
- <button type="button" class="btn btn-success lc-btn-sortable" data-toggle="tooltip"
- title="Trier les images">
- <i class="fa fa-arrows-alt"></i>
- </button>
- {% endif %}
- <button type="button" class="btn btn-primary lc-filemanager-open" data-id="{{ form.path.vars.id }}"
- data-toggle="tooltip" title="Sélectionner un fichier"
- data-target="{{ path('file_manager', {module:1, conf:'default'})|raw }}">
- <i class="fa fa-folder-open"></i>
- </button>
- </div>
- {{ form_widget(form.legend) }}
- <div class="input-group-append">
- <button type="button" class="btn btn-danger lc-filemanager-delete" data-toggle="tooltip"
- title="Supprimer l'image"
- data-id="{{ form.path.vars.id }}">
- <i class="fa fa-trash"></i>
- </button>
- </div>
-
-
- {{ form_rest(form) }}
- </div>
- </div>
- </div>
- {% endblock file_manager_widget %}
-
- {% block checkbox_radio_label -%}
- {#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
- {%- if widget is defined -%}
- {% 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) %}
- {% 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) %}
- {%- if is_parent_custom or is_custom -%}
- {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
- {%- else %}
- {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}
- {%- endif %}
- {%- if not compound -%}
- {% set label_attr = label_attr|merge({'for': id}) %}
- {%- endif -%}
- {%- if required -%}
- {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%}
- {%- endif -%}
- {%- if parent_label_class is defined -%}
- {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': ''})|trim}) -%}
- {%- endif -%}
- {%- if label is not same as(false) and label is empty -%}
- {%- if label_format is not empty -%}
- {%- set label = label_format|replace({
- '%name%': name,
- '%id%': id,
- }) -%}
- {%- else -%}
-
- {%- set label = name|humanize -%}
- {%- endif -%}
- {%- endif -%}
-
- <label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
- {{ widget|raw }}
- <span class="checkmark"></span>
-
- {# {% if translation_domain == 'lcshop' %}
- {{ name|lc_trad(easyadmin['entity']['name'], 'field') }}
- {% else %} #}
- {{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain))|raw -}}
-
- {# {% endif %} #}
- {{- form_errors(form) -}}
- </label>
- {%- endif -%}
- {%- endblock checkbox_radio_label %}
-
- {% block form_start %}
-
- {{ parent() }}
-
- {% if ea_crud_form.form_panels is defined %}
-
- <div class="card card-outline">
- <div class="card-header p-0 border-bottom-0">
- <ul id="nav-params" class="nav nav-pills" role="navigation">
- {% for panel_name, panel_config in ea_crud_form.form_panels|filter(panel_config => not panel_config.form_tab or panel_config.form_tab == tab_name) %}
- {% set panel_has_header = panel_config.label|default(false) or panel_config.icon|default(false) %}
- <li class="nav-item">
- <a href="#panel-{{ panel_name }} " class="nav-link {{ panel_name == 1 ? 'active' }}" data-toggle="tab" role="tab"
- aria-controls="panel-{{ panel_name }}">
- {{ panel_config.label|lc_trans_admin_panel(ea.getEntity().getFqcn()) }}
- <i class="fa fa-exclamation-circle invalid-form"></i>
- </a>
- </li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
- {% endblock form_start %}
-
- {% block ea_crud_widget_panels %}
- <div class="tab-content">
- {% for panel_name, panel_config in ea_crud_form.form_panels|filter(panel_config => not panel_config.form_tab or panel_config.form_tab == tab_name) %}
- {% set panel_has_header = panel_config.label|default(false) or panel_config.icon|default(false) %}
-
- {% set collapsible = panel_config.collapsible %}
- {% set collapsed = panel_config.collapsed %}
-
- <div class="tab-pane {{ panel_name == 1 ? 'active' }}" id="panel-{{ panel_name }}"
- aria-labelledby="{{ panel_name }}-tab">
- {% if panel_config.template is defined and panel_config.template is not null %}
- {% include panel_config.template %}
- {% else %}
-
- <div class="card {{ panel_config.css_class ?? '' }}">
- <div class="card-status-top bg-primary"></div>
- <div class="card-header ">
- {% if panel_has_header %}
- {# <div class="content-panel-header {{ collapsible ? 'collapsible' }} {{ panel_config.help|default(false) is not empty ? 'with-help' }}"> #}
- {% if collapsible %}
- <a href="#content-{{ panel_name }}" data-toggle="collapse" class="content-panel-collapse {{ collapsed ? 'collapsed' }}" aria-expanded="{{ collapsed ? 'false' : 'true' }}" aria-controls="content-{{ panel_name }}">
- <i class="fas fw fa-chevron-right collapse-icon"></i>
- {% endif %}
-
- {% if panel_config.icon|default(false) %}
- <i class="{{ panel_config.icon }}"></i>
- {% endif %}
-
- {{ panel_config.label|lc_trans_admin_panel(ea.getEntity().getFqcn()) }}
-
- {% if collapsible %}
- </a>
- {% endif %}
-
- {% if panel_config.help|default(false) %}
- <div class="content-panel-header-help">{{ panel_config.help|raw }}</div>
- {% endif %}
-
- {% endif %}
- </div>
- <div class="card-body {{ collapsible ? 'collapse' }} {{ not collapsed ? 'show' }}">
- {% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and field.vars.ea_crud_form.form_panel == panel_name) %}
- {% if not field.vars.ea_crud_form.form_tab or field.vars.ea_crud_form.form_tab == tab_name %}
- {{ form_row(field) }}
- {% endif %}
- {% endfor %}
- </div>
- </div>
- {% endif %}
- </div>
-
- {% else %}
- <div class="card">
- <div class="card-status-top bg-primary"></div>
- <div class="card-header "></div>
- <div class="card-body">
-
- {% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and (not field.vars.ea_crud_form.form_tab or field.vars.ea_crud_form.form_tab == tab_name)) %}
- {{ form_row(field) }}
- {% endfor %}
- </div>
- </div>
- {% endfor %}
- </div>
-
- {% endblock ea_crud_widget_panels %}
|