在奏鸣曲管理中隐藏下载按钮 [英] Hide download button in sonata admin
本文介绍了在奏鸣曲管理中隐藏下载按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想对某些自定义实体隐藏 Sonata Admin 上的下载"按钮.如何隐藏/删除它?
I would like to hide "Download" button on Sonata Admin from some of custom entity. How to hide/delete it?
如果我覆盖 base_list.html.twig
并从 table_footer 中删除下载按钮,它会消失所有实体列表.有什么办法可以在 Admin 类中隐藏它吗?
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?
推荐答案
问题已解决!
我通过管理用户角色解决了这个问题.例如:
PROBLEM SOLVED!
I solved it by managing user roles. For example:
您想删除发布"部分中的下载"按钮.所以你需要在 app/config/security.yml
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.
这篇关于在奏鸣曲管理中隐藏下载按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文