1

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

Juan Gonzales
  • 117
  • 3
  • 10
  • May be by hooking an event, but not sure it can be done. https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Resources/doc/book/7-complex-dynamic-backends.md – COil Mar 04 '17 at 10:14
  • @Coil I reviewed all of their documentation, but I still haven't figure out how to change the actions links based on status. Basically, if I have an item with status A I don't want to show the edit button. Docs shows how to remove from entity but not from code – Juan Gonzales Mar 04 '17 at 21:43
  • I think you could override the @EasyAdmin/default/includes/_actions.html.twig template. To try. – COil Mar 04 '17 at 21:48

1 Answers1

1

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 %}
Javier Eguiluz
  • 3,987
  • 2
  • 23
  • 44