|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- {% set dropdownAction ={} %}
- {% for action in actions %}
-
- {% if action.group is defined and action.group==true %}
- {% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %}
- {% else %}
- {% set display_button = true %}
-
- {% if 'list' == action.name %}
- {% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %}
- {% elseif 'method' == action.type %}
- {% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %}
- {% elseif 'route' == action.type %}
- {% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %}
- {% elseif 'productfamily_advanced_editing' == action.type %}
- {% set action_href = path('easyadmin', request_parameters|merge({ action: action.action, id: item_id })) %}
- {% if action.name == 'products' and not item.activeProducts %}
- {% set display_button = false %}
- {% endif %}
- {% endif %}
-
- {% if display_button %}
- {{ include(action.template, {
- action: action,
- action_href: action_href,
- is_dropdown: is_dropdown|default(false),
- item: item,
- item_id: item_id,
- request_parameters: request_parameters,
- translation_domain: translation_domain,
- trans_parameters: trans_parameters,
- }, with_context = false) }}
- {% endif %}
- {% endif %}
- {% endfor %}
- {% if dropdownAction|length > 0 %}
- <div class="btn-group">
- <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-icon" aria-expanded="false">
- <span class="sr-only">Toggle Dropdown</span>
- <div class="dropdown-menu dropdown-menu-right" role="menu">
- {% for action in dropdownAction %}
-
- {% if 'list' == action.name %}
- {% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %}
- {% elseif 'method' == action.type %}
- {% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %}
- {% elseif 'route' == action.type %}
- {% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %}
- {% endif %}
-
- {{ include(action.template, {
- action: action,
- action_href: action_href,
- is_dropdown: true,
- item: item,
- item_id: item_id,
- request_parameters: request_parameters,
- translation_domain: translation_domain,
- trans_parameters: trans_parameters,
- }, with_context = false) }}
- {% endfor %}
- </div>
- </button>
- </div>
-
- {% endif %}
|