You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.html.twig 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {% set dropdownAction ={} %}
  2. {% for action in actions %}
  3. {% if action.group is defined and action.group==true %}
  4. {% set dropdownAction = dropdownAction|merge({(loop.index0): action}) %}
  5. {% else %}
  6. {% if 'list' == action.name %}
  7. {% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %}
  8. {% elseif 'method' == action.type %}
  9. {% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %}
  10. {% elseif 'route' == action.type %}
  11. {% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %}
  12. {% endif %}
  13. {{ include(action.template, {
  14. action: action,
  15. action_href: action_href,
  16. is_dropdown: is_dropdown|default(false),
  17. item: item,
  18. item_id: item_id,
  19. request_parameters: request_parameters,
  20. translation_domain: translation_domain,
  21. trans_parameters: trans_parameters,
  22. }, with_context = false) }}
  23. {% endif %}
  24. {% endfor %}
  25. {% if dropdownAction|length > 0 %}
  26. <div class="btn-group">
  27. <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-icon" aria-expanded="false">
  28. <span class="sr-only">Toggle Dropdown</span>
  29. <div class="dropdown-menu dropdown-menu-right" role="menu">
  30. {% for action in dropdownAction %}
  31. {% if 'list' == action.name %}
  32. {% set action_href = request_parameters.referer|default('') ? request_parameters.referer|easyadmin_urldecode : path('easyadmin', request_parameters|merge({ action: 'list' })) %}
  33. {% elseif 'method' == action.type %}
  34. {% set action_href = path('easyadmin', request_parameters|merge({ action: action.name, id: item_id })) %}
  35. {% elseif 'route' == action.type %}
  36. {% set action_href = path(action.name, request_parameters|merge({ action: action.name, id: item_id })) %}
  37. {% endif %}
  38. {{ include(action.template, {
  39. action: action,
  40. action_href: action_href,
  41. is_dropdown: true,
  42. item: item,
  43. item_id: item_id,
  44. request_parameters: request_parameters,
  45. translation_domain: translation_domain,
  46. trans_parameters: trans_parameters,
  47. }, with_context = false) }}
  48. {% endfor %}
  49. </div>
  50. </button>
  51. </div>
  52. {% endif %}