|
|
@@ -13,112 +13,116 @@ |
|
|
|
{%- else -%} |
|
|
|
{% set form_method = "POST" %} |
|
|
|
{%- endif -%} |
|
|
|
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}> |
|
|
|
<form{% if name != '' %} name="{{ name }}"{% endif %} |
|
|
|
method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}> |
|
|
|
{%- if form_method != method -%} |
|
|
|
<input type="hidden" name="_method" value="{{ method }}" /> |
|
|
|
<input type="hidden" name="_method" value="{{ method }}"/> |
|
|
|
{%- endif -%} |
|
|
|
|
|
|
|
<input type="hidden" name="referrer" value="{% if ea is defined %}{{ ea.request.query.get('referrer') }}{% endif %}"> |
|
|
|
{% endblock form_start %} |
|
|
|
<input type="hidden" name="referrer" |
|
|
|
value="{% if ea is defined %}{{ ea.request.query.get('referrer') }}{% endif %}"> |
|
|
|
{% endblock form_start %} |
|
|
|
|
|
|
|
{% block form_row %} |
|
|
|
{% set row_attr = row_attr|merge({ |
|
|
|
class: row_attr.class|default('') ~ ' form-group' |
|
|
|
}) %} |
|
|
|
{% 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"> |
|
|
|
<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 %} |
|
|
|
#} |
|
|
|
#} |
|
|
|
|
|
|
|
{% set has_prepend_html = false %} |
|
|
|
{% set has_append_html = false %} |
|
|
|
{% set has_input_groups = false %} |
|
|
|
|
|
|
|
{% if ea_crud_form.ea_field is defined and ea_crud_form.ea_field is not null %} |
|
|
|
{% set prepend_html = ea_crud_form.ea_field.customOptions.get('prependHtml') %} |
|
|
|
{% set append_html = ea_crud_form.ea_field.customOptions.get('appendHtml') %} |
|
|
|
{% set has_prepend_html = prepend_html is not null %} |
|
|
|
{% set has_append_html = append_html is not null %} |
|
|
|
{% set has_input_groups = has_prepend_html or has_append_html %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% set has_prepend_html = false %} |
|
|
|
{% set has_append_html = false %} |
|
|
|
{% set has_input_groups = false %} |
|
|
|
{% if has_input_groups %} |
|
|
|
<div class="input-group">{% endif %} |
|
|
|
{% if has_prepend_html %} |
|
|
|
<div class="input-group-prepend"> |
|
|
|
<span class="input-group-text">{{ prepend_html|raw }}</span> |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% if ea_crud_form.ea_field is defined and ea_crud_form.ea_field is not null %} |
|
|
|
{% set prepend_html = ea_crud_form.ea_field.customOptions.get('prependHtml') %} |
|
|
|
{% set append_html = ea_crud_form.ea_field.customOptions.get('appendHtml') %} |
|
|
|
{% set has_prepend_html = prepend_html is not null %} |
|
|
|
{% set has_append_html = append_html is not null %} |
|
|
|
{% set has_input_groups = has_prepend_html or has_append_html %} |
|
|
|
{% endif %} |
|
|
|
{{ form_widget(form) }} |
|
|
|
|
|
|
|
{% if has_input_groups %} |
|
|
|
<div class="input-group">{% endif %} |
|
|
|
{% if has_prepend_html %} |
|
|
|
<div class="input-group-prepend"> |
|
|
|
<span class="input-group-text">{{ prepend_html|raw }}</span> |
|
|
|
{% if has_append_html %} |
|
|
|
<div class="input-group-append"> |
|
|
|
<span class="input-group-text">{{ 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 %} |
|
|
|
|
|
|
|
{{ form_widget(form) }} |
|
|
|
|
|
|
|
{% if has_append_html %} |
|
|
|
<div class="input-group-append"> |
|
|
|
<span class="input-group-text">{{ append_html|raw }}</span> |
|
|
|
</div> |
|
|
|
{% set help_message = name|sov_trans_admin_help(form.parent.vars.data) %} |
|
|
|
{% if help_message != '' %} |
|
|
|
<small class="form-help">{{ help_message }}</small> |
|
|
|
{% 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|sov_trans_admin_help(form.parent.vars.data) %} |
|
|
|
{% if help_message != '' %} |
|
|
|
<small class="form-help">{{ help_message }}</small> |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{{- form_errors(form) -}} |
|
|
|
{{- form_errors(form) -}} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endblock form_row %} |
|
|
|
{% endblock form_row %} |
|
|
|
|
|
|
|
{% block form_label -%} |
|
|
|
{% block form_label -%} |
|
|
|
{% if label is same as(false) -%} |
|
|
|
<label>{# the empty <label> is needed to not break the form design #}</label> |
|
|
|
<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}) -%} |
|
|
|
{%- 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_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 -%} |
|
|
|
{# {% set label = name|humanize %} #} |
|
|
|
{%- endif -%} |
|
|
|
{%- endif -%} |
|
|
|
|
|
|
|
{% set entityNameOrObject = form.parent.vars.data %} |
|
|
|
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} |
|
|
|
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} |
|
|
|
{% endif %} |
|
|
|
{% set entityNameOrObject = form.parent.vars.data %} |
|
|
|
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} |
|
|
|
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
<{{ 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|sov_trans_admin_field(entityNameOrObject) }}</{{ 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|sov_trans_admin_field(entityNameOrObject) }} |
|
|
|
</{{ element|default('label') }}> |
|
|
|
|
|
|
|
{%- endif -%} |
|
|
|
{%- endblock form_label %} |
|
|
@@ -216,8 +220,8 @@ |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
<div class="col-12"> |
|
|
|
{# {{ dump(form.vars) }}#} |
|
|
|
{# {{ dump(form.vars.ea_crud_form.ea_field) }}#} |
|
|
|
{# {{ dump(form.vars) }} #} |
|
|
|
{# {{ dump(form.vars.ea_crud_form.ea_field) }} #} |
|
|
|
<div class="input-group"> |
|
|
|
<div class="input-group-prepend"> |
|
|
|
{% if form.parent.vars['row_attr']['data-sortable'] is defined %} |
|
|
@@ -226,7 +230,8 @@ |
|
|
|
<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 }}" |
|
|
|
<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: managerDir})|raw }}"> |
|
|
|
<i class="fa fa-folder-open"></i> |
|
|
@@ -249,7 +254,7 @@ |
|
|
|
{% 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 -#} |
|
|
|
{#- 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) %} |
|
|
@@ -279,19 +284,27 @@ |
|
|
|
{%- endif -%} |
|
|
|
{%- endif -%} |
|
|
|
|
|
|
|
{% if attr.disabled is defined and attr.disabled %} |
|
|
|
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' disabled')|trim}) -%} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}> |
|
|
|
{{ widget|raw }} |
|
|
|
<span class="checkmark"></span> |
|
|
|
|
|
|
|
{# {{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain))|raw -}} #} |
|
|
|
{# {{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain))|raw -}} #} |
|
|
|
|
|
|
|
{% set entityNameOrObject = form.parent.vars.data %} |
|
|
|
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} |
|
|
|
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{{- (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|sov_trans_admin_field(entityNameOrObject) -}} |
|
|
|
|
|
|
|
<!-- lorsque que le name est un entier "case radio"--> |
|
|
|
{% if name matches '/^\\d+$/' %} |
|
|
|
{{- label|trans({}, 'admin') -}} |
|
|
|
{% else %} |
|
|
|
{{- (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|sov_trans_admin_field(entityNameOrObject) -}} |
|
|
|
{% endif %} |
|
|
|
{{- form_errors(form) -}} |
|
|
|
</label> |
|
|
|
{%- endif -%} |