vendor/sonata-project/admin-bundle/src/Resources/views/CRUD/Association/edit_one_to_many.html.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% if not sonata_admin.field_description.hasassociationadmin %}
  8.     {% for element in value %}
  9.         {{ element|render_relation_element(sonata_admin.field_description) }}
  10.     {% endfor %}
  11. {% else %}
  12.     <div id="field_container_{{ id }}" class="field-container">
  13.         <span id="field_widget_{{ id }}" >
  14.             {% if sonata_admin.edit == 'inline' %}
  15.                 {% if sonata_admin.inline == 'table' %}
  16.                     {% if form.children|length > 0 %}
  17.                         {% include '@SonataAdmin/CRUD/Association/edit_one_to_many_inline_table.html.twig' %}
  18.                     {% endif %}
  19.                 {% elseif form.children|length > 0 %}
  20.                     {% set associationAdmin = sonata_admin.field_description.associationadmin %}
  21.                     {% include '@SonataAdmin/CRUD/Association/edit_one_to_many_inline_tabs.html.twig' %}
  22.                 {% endif %}
  23.             {% else %}
  24.                 {{ form_widget(form) }}
  25.             {% endif %}
  26.         </span>
  27.         {% set display_create_button = sonata_admin.field_description.associationadmin.hasRoute('create')
  28.             and sonata_admin.field_description.associationadmin.hasAccess('create')
  29.             and btn_add
  30.             and (
  31.                 sonata_admin.field_description.option('limit') is null or
  32.                 form.children|length < sonata_admin.field_description.option('limit')
  33.             ) %}
  34.         {% if sonata_admin.edit == 'inline' %}
  35.             {% if display_create_button %}
  36.                 <span id="field_actions_{{ id }}" >
  37.                     <a
  38.                         href="{{ sonata_admin.field_description.associationadmin.generateUrl(
  39.                             'create',
  40.                             sonata_admin.field_description.getOption('link_parameters', {})
  41.                         ) }}"
  42.                         onclick="return start_field_retrieve_{{ id }}(this);"
  43.                         class="btn btn-success btn-sm sonata-ba-action"
  44.                         {# NEXT_MAJOR: Remove the fallback on null and on btn_catalogue #}
  45.                         title="{{
  46.                             btn_translation_domain|default(null) is same as(false)
  47.                             ? btn_add
  48.                             : btn_add|trans({}, btn_translation_domain|default(btn_catalogue))
  49.                         }}"
  50.                     >
  51.                         <i class="fas fa-plus-circle"></i>
  52.                         {# NEXT_MAJOR: Remove the fallback on null and on btn_catalogue #}
  53.                         {{
  54.                             btn_translation_domain|default(null) is same as(false)
  55.                             ? btn_add
  56.                             : btn_add|trans({}, btn_translation_domain|default(btn_catalogue))
  57.                         }}
  58.                     </a>
  59.                 </span>
  60.             {% endif %}
  61.             {# add code for the sortable options #}
  62.             {% if sonata_admin.field_description.option('sortable', false) %}
  63.                 {% if sonata_admin.inline == 'table' %}
  64.                     {% include '@SonataAdmin/CRUD/Association/edit_one_to_many_sortable_script_table.html.twig' %}
  65.                 {% else %}
  66.                     {% include '@SonataAdmin/CRUD/Association/edit_one_to_many_sortable_script_tabs.html.twig' %}
  67.                 {% endif %}
  68.             {% endif %}
  69.             {# include association code #}
  70.             {% include '@SonataAdmin/CRUD/Association/edit_one_script.html.twig' %}
  71.         {% else %}
  72.             <span id="field_actions_{{ id }}" >
  73.                 {% if display_create_button %}
  74.                     <a
  75.                         href="{{ sonata_admin.field_description.associationadmin.generateUrl(
  76.                             'create',
  77.                             sonata_admin.field_description.getOption('link_parameters', {})
  78.                         ) }}"
  79.                         onclick="return start_field_dialog_form_add_{{ id }}(this);"
  80.                         class="btn btn-success btn-sm sonata-ba-action"
  81.                         {# NEXT_MAJOR: Remove the fallback on null and on btn_catalogue #}
  82.                         title="{{
  83.                             btn_translation_domain|default(null) is same as(false)
  84.                             ? btn_add
  85.                             : btn_add|trans({}, btn_translation_domain|default(btn_catalogue))
  86.                         }}"
  87.                     >
  88.                         <i class="fas fa-plus-circle"></i>
  89.                         {# NEXT_MAJOR: Remove the fallback on null and on btn_catalogue #}
  90.                         {{
  91.                             btn_translation_domain|default(null) is same as(false)
  92.                             ? btn_add
  93.                             : btn_add|trans({}, btn_translation_domain|default(btn_catalogue))
  94.                         }}
  95.                     </a>
  96.                     {% include '@SonataAdmin/CRUD/Association/edit_modal.html.twig' %}
  97.                     {% include '@SonataAdmin/CRUD/Association/edit_many_script.html.twig' %}
  98.                 {% endif %}
  99.             </span>
  100.         {% endif %}
  101.     </div>
  102. {% endif %}