Custom action templates broken with ActionMenu component
Describe the bug After updating the EasyAdmin package in our application, we noticed that custom action template paths no longer work when rendering the index page (using dropdowns for entity actions).
I'm assuming this is due to the addition of the ActionMenu Twig component in 4.20.6
When calling showEntityActionsInlined whilst configuring Crud, the custom templates still work correctly, but (unless I missed it) there is no indication anywhere that this feature is exclusive to this mode.
To Reproduce Set a custom template path on an action that is displayed for each entity on the index page. (Do not enable inlined entity actions.) The template path will not be used.
Action::new('doStuff')->setTemplatePath('do-stuff-action.html.twig')
Additional context We are using this functionality to add stimulus controller information to these buttons, for example so we can open a modal for some actions that we don't want to perform a complete page redirect for.
I'm not sure whether this is fixable, or how easy it would be to do so. Twig components are completely new to me, and I have many other issues to fix due to updating our packages, so no time to really dive into it.
So just a quick response with some thoughts about this would be greatly appreciated @javiereguiluz.
(When all else fails, I suppose I could customize the inline rendering to mimic the old dropdown implementation. But I'd rather override as little as possible, as every override will need to be re-evaluated when we update the next time.)
To have something that works I added this quick fix to our bundle overrides
{% extends '@!EasyAdmin/crud/index.html.twig' %}
{% block entity_actions %}
<td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
{% if entity.actions.count > 0 %}
{% if ea.crud.showEntityActionsAsDropdown %}
<twig:ea:ActionMenu class="dropdown-actions">
<twig:ea:ActionMenu:Button withoutDropdownToggleMarker>
<twig:ea:Icon name="internal:dots-horizontal" />
</twig:ea:ActionMenu:Button>
<twig:ea:ActionMenu:Overlay>
<twig:ea:ActionMenu:ActionList>
{% for action in entity.actions %}
{# Fix dropdown actions with custom template path #}
<li>
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
</li>
{% endfor %}
</twig:ea:ActionMenu:ActionList>
</twig:ea:ActionMenu:Overlay>
</twig:ea:ActionMenu>
{% else %}
{% for action in entity.actions %}
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
{% endfor %}
{% endif %}
{% endif %}
</td>
{% endblock %}
But yeah, not ideal.
I've the same issue. Can not display the code in twig like before. I'm using bootstrap modal and stimulus handle the logic
<a class="dropdown-item" href="#"
data-order-id="{{ entity.instance.id }}"
data-pending-payment="{{ entity.instance.sellingPrice - entity.instance.paid }}"
data-order-code="{{ entity.instance.code }}"
data-bs-target="#modal-note-order"
data-bs-toggle="modal"
data-note="{{ entity.instance.note }}"
>
{{ action.label }}
</a>