vendor/sonata-project/admin-bundle/src/Resources/views/CRUD/base_edit_form.html.twig line 29

Open in your IDE?
  1. {% block form %}
  2.     {{ sonata_block_render_event('sonata.admin.edit.form.top', { 'admin': admin, 'object': object }) }}
  3.     {# NEXT_MAJOR: remove default filter #}
  4.     {% set url = objectId|default(admin.id(object)) is not null ? 'edit' : 'create' %}
  5.     {% if not admin.hasRoute(url) %}
  6.         <div>
  7.             {{ "form_not_available"|trans({}, "SonataAdminBundle") }}
  8.         </div>
  9.     {% else %}
  10.         <form
  11.               {% if sonata_admin.adminPool.getOption('form_type') == 'horizontal' %}class="form-horizontal"{% endif %}
  12.               role="form"
  13.               {# NEXT_MAJOR: remove default filter #}
  14.               action="{% block sonata_form_action_url %}{{ admin.generateUrl(url, {'id': objectId|default(admin.id(object)), 'uniqid': admin.uniqid, 'subclass': app.request.get('subclass')}) }}{% endblock %}"
  15.               {% if form.vars.multipart %} enctype="multipart/form-data"{% endif %}
  16.               method="POST"
  17.               {% if not sonata_admin.adminPool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
  18.               {% block sonata_form_attributes %}{% endblock %}
  19.               >
  20.             {{ include('@SonataAdmin/Helper/render_form_dismissable_errors.html.twig') }}
  21.             {% block sonata_pre_fieldsets %}
  22.                 <div class="row">
  23.             {% endblock %}
  24.             {% block sonata_tab_content %}
  25.                 {% import "@SonataAdmin/CRUD/base_edit_form_macro.html.twig" as form_helper %}
  26.                 {# NEXT_MAJOR: Remove the sonata_deprecation_mute param. #}
  27.                 {% set formtabs = admin.getformtabs('sonata_deprecation_mute') %}
  28.                 {% set has_tab = ((formtabs|length == 1 and formtabs|keys[0] != 'default') or formtabs|length > 1 ) %}
  29.                 <div class="col-md-12">
  30.                     {% if has_tab %}
  31.                         {% set tab_prefix = 'tab_' ~ admin.uniqid ~ '_' ~ random() %}
  32.                         {% set tab_query_index = app.request.query.get('_tab', 0)|split("_")|last %}
  33.                         <div class="nav-tabs-custom">
  34.                             <ul class="nav nav-tabs" role="tablist">
  35.                                 {% for name, form_tab in formtabs %}
  36.                                     {% set _tab_name = tab_prefix ~ '_' ~ loop.index %}
  37.                                     <li{% if (not app.request.query.has('_tab') and loop.index == 1) or (tab_query_index == loop.index) %} class="active"{% endif %}>
  38.                                         <a href="#{{ _tab_name }}" class="changer-tab" aria-controls="{{ _tab_name }}" data-toggle="tab">
  39.                                             <i class="fa fa-exclamation-circle has-errors hide" aria-hidden="true"></i> {{ form_tab.label|trans({}, form_tab.translation_domain ?: admin.translationDomain) }}
  40.                                         </a>
  41.                                     </li>
  42.                                 {% endfor %}
  43.                             </ul>
  44.                             <div class="tab-content">
  45.                                 {% for code, form_tab in formtabs %}
  46.                                     {% set _tab_name = tab_prefix ~ '_' ~ loop.index %}
  47.                                     <div
  48.                                         class="tab-pane fade{% if (not app.request.query.has('_tab') and loop.first) or (tab_query_index == loop.index) %} in active{% endif %}"
  49.                                         id="{{ _tab_name }}"
  50.                                     >
  51.                                         <div class="box-body  container-fluid">
  52.                                             <div class="sonata-ba-collapsed-fields">
  53.                                                 {% if form_tab.description != false %}
  54.                                                     <p>
  55.                                                         {{ form_tab.description|trans({}, form_tab.translation_domain ?: admin.translationDomain)|raw }}
  56.                                                     </p>
  57.                                                 {% endif %}
  58.                                                 {{ form_helper.render_groups(admin, form, form_tab['groups'], has_tab) }}
  59.                                             </div>
  60.                                         </div>
  61.                                     </div>
  62.                                 {% endfor %}
  63.                             </div>
  64.                             <input type="hidden" name="_tab" value="{{ app.request.query.get('_tab') }}">
  65.                         </div>
  66.                     {% elseif formtabs['default'] is defined %}
  67.                         {{ form_helper.render_groups(admin, form, formtabs['default'].groups, has_tab) }}
  68.                     {% endif %}
  69.                 </div>
  70.             {% endblock %}
  71.             {% block sonata_post_fieldsets %}
  72.                 </div>
  73.             {% endblock %}
  74.             {{ form_rest(form) }}
  75.             {% block formactions %}
  76.                 <div class="sonata-ba-form-actions well well-small form-actions">
  77.                 {% block sonata_form_actions %}
  78.                     {% if app.request.isxmlhttprequest %}
  79.                         {# NEXT_MAJOR: remove default filter #}
  80.                         {% if objectId|default(admin.id(object)) is not null %}
  81.                             <button type="submit" class="btn btn-success" name="btn_update"><i class="fa fa-save" aria-hidden="true"></i> {{ 'btn_update'|trans({}, 'SonataAdminBundle') }}</button>
  82.                             {% if admin.hasRoute('delete') and admin.hasAccess('delete', object) %}
  83.                                 {{ 'delete_or'|trans({}, 'SonataAdminBundle') }}
  84.                                 <a class="btn btn-danger" href="{{ admin.generateObjectUrl('delete', object) }}">
  85.                                     <i class="fa fa-minus-circle" aria-hidden="true"></i> {{ 'link_delete'|trans({}, 'SonataAdminBundle') }}
  86.                                 </a>
  87.                             {% endif %}
  88.                         {% else %}
  89.                             <button type="submit" class="btn btn-success" name="btn_create"><i class="fa fa-plus-circle" aria-hidden="true"></i> {{ 'btn_create'|trans({}, 'SonataAdminBundle') }}</button>
  90.                         {% endif %}
  91.                     {% else %}
  92.                         {% if admin.supportsPreviewMode %}
  93.                             <button class="btn btn-info persist-preview" name="btn_preview" type="submit">
  94.                                 <i class="fa fa-eye" aria-hidden="true"></i>
  95.                                 {{ 'btn_preview'|trans({}, 'SonataAdminBundle') }}
  96.                             </button>
  97.                         {% endif %}
  98.                         {# NEXT_MAJOR: remove default filter #}
  99.                         {% if objectId|default(admin.id(object)) is not null %}
  100.                             <button type="submit" class="btn btn-success" name="btn_update_and_edit"><i class="fa fa-save" aria-hidden="true"></i> {{ 'btn_update_and_edit_again'|trans({}, 'SonataAdminBundle') }}</button>
  101.                             {% if admin.hasRoute('list') and admin.hasAccess('list') %}
  102.                                 <button type="submit" class="btn btn-success" name="btn_update_and_list"><i class="fa fa-save"></i> <i class="fa fa-list" aria-hidden="true"></i> {{ 'btn_update_and_return_to_list'|trans({}, 'SonataAdminBundle') }}</button>
  103.                             {% endif %}
  104.                             {% if admin.hasRoute('delete') and admin.hasAccess('delete', object) %}
  105.                                 {{ 'delete_or'|trans({}, 'SonataAdminBundle') }}
  106.                                 <a class="btn btn-danger" href="{{ admin.generateObjectUrl('delete', object) }}"><i class="fa fa-minus-circle" aria-hidden="true"></i> {{ 'link_delete'|trans({}, 'SonataAdminBundle') }}</a>
  107.                             {% endif %}
  108.                             {% if admin.isAclEnabled() and admin.hasRoute('acl') and admin.hasAccess('acl', object) %}
  109.                                 <a class="btn btn-info" href="{{ admin.generateObjectUrl('acl', object) }}"><i class="fa fa-users" aria-hidden="true"></i> {{ 'link_edit_acl'|trans({}, 'SonataAdminBundle') }}</a>
  110.                             {% endif %}
  111.                         {% else %}
  112.                             {% if admin.hasroute('edit') and admin.hasAccess('edit') %}
  113.                                 <button class="btn btn-success" type="submit" name="btn_create_and_edit"><i class="fa fa-save" aria-hidden="true"></i> {{ 'btn_create_and_edit_again'|trans({}, 'SonataAdminBundle') }}</button>
  114.                             {% endif %}
  115.                             {% if admin.hasroute('list') and admin.hasAccess('list') %}
  116.                                 <button type="submit" class="btn btn-success" name="btn_create_and_list"><i class="fa fa-save"></i> <i class="fa fa-list" aria-hidden="true"></i> {{ 'btn_create_and_return_to_list'|trans({}, 'SonataAdminBundle') }}</button>
  117.                             {% endif %}
  118.                             <button class="btn btn-success" type="submit" name="btn_create_and_create"><i class="fa fa-plus-circle" aria-hidden="true"></i> {{ 'btn_create_and_create_a_new_one'|trans({}, 'SonataAdminBundle') }}</button>
  119.                         {% endif %}
  120.                     {% endif %}
  121.                 {% endblock %}
  122.                 </div>
  123.             {% endblock formactions %}
  124.         </form>
  125.     {% endif %}
  126.     {{ sonata_block_render_event('sonata.admin.edit.form.bottom', { 'admin': admin, 'object': object }) }}
  127. {% endblock %}