Search code examples
symfonysymfony2-easyadmin

Symfony 3.2 Easyadminbundle how to hide/remove default actions link


I was wondering if someone can tell me how to hide the action links from the list view base on a status column.

More details: I have a list view in which shows a list of items, In this list I have column named status. For each record in this list in which status is set to close, I would like to hide the edit/delete and other custom actions links from the list. Is this doable? if so, how?

Thanks


Solution

  • A possible solution is to override just the item_actions Twig block in the list.html.twig template used by that entity. In practice, if the entity is called Order, a template like this should work:

    {# app/Resources/views/easy_admin/Order/list.html.twig #}
    {% extends '@EasyAdmin/default/list.html.twig' %}
    {% block item_actions %}
        {% if item.status != 'close' %}
            {{ parent() }}
        {% endif %}
    {% endblock item_actions %}