Sonata 管理仪表板:配置每个实体的操作 [英] Sonata Admin Dashboard: configure actions per entity

查看:22
本文介绍了Sonata 管理仪表板:配置每个实体的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SonataAdminBundle 作为基于 Symfony2 (v2.0.x) 的网站的管理界面的基础.

I'm using the SonataAdminBundle as base for an administration interface for a Symfony2 (v2.0.x) powered website.

在 SonataAdmin 中添加到仪表板的实体默认具有以下操作:

Entities which are added to the dashboard in SonataAdmin have the following actions by default:

  • 添加
  • 列表

这适用于大多数实体,但是该网站有一些实体的数据未通过管理界面添加 - 即它们是从面向公众的网站输入的.管理员只需要查看它们(仪表板中的列表"操作)、编辑它们或删除它们.管理员不应向这些实体添加数据.

This works fine for most entities, however the website has a few entities for which data is not added via the admin interface - i.e. they are entered from the public facing website. Administrators only need to view them ("list" action in dashboard), edit them or delete them. Administrators should not be able to add data to these entities.

有没有办法配置在 SonataAdmin 仪表板中各个实体旁边显示哪些操作?

Is there a way to configure which actions are displayed next to individual entities in SonataAdmin dashboard?

推荐答案

在您的 EntityAdmin 类中添加以下内容

In your EntityAdmin class add following

public function configureRoutes(RouteCollection $collection)
{
  $collection->remove('create');
}

这篇关于Sonata 管理仪表板:配置每个实体的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆