選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

67 行
3.2KB

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