Search code examples
symfonysonata-adminsonata

Hide download button in sonata admin


I would like to hide "Download" button on Sonata Admin from some of custom entity. How to hide/delete it?

If i override base_list.html.twig and remove the download button from table_footer, it disappears all of entity lists. Is there any way to hide it from Admin class?


Solution

  • PROBLEM SOLVED!

    I solved it by managing user roles. For example:

    You want to remove Download button in Post section. So you need to add below code in app/config/security.yml

    security:
        role_hierarchy:
            ROLE_PUBLISHER:
                - ROLE_ADMIN_POST_CREATE
                - ROLE_ADMIN_POST_EDIT
                - ROLE_ADMIN_POST_LIST
                - ROLE_ADMIN_POST_VIEW
                - ROLE_ADMIN_POST_EXPORT #If you comment or delete this line. Download button don't show in Sonata Post List.