修改 Sonata 中的列表视图 [英] Modifying list view in Sonata
问题描述
我在一个 Symfony 项目中使用 SonataAdminBundle,我想列出不在表格中的实体,而是使用垂直选项卡.所以,我想要一个选项卡,对应于每个实体,以便推动这个选项卡打开由 configureListFields
在右侧选择的字段.
I'm using SonataAdminBundle for a Symfony project and I want to list entities not in table, but using vertical tabs. So, I want to have a tab, corresponding to each entity, so that pushing this tab opens fields selected by configureListFields
at the right.
奏鸣曲能做到吗?
感谢您的帮助.
推荐答案
如 SonataAdmin 文档,可以覆盖 Sonata 用来呈现管理 UI 的默认模板:
As mentionned on the SonataAdmin documentation, it is possible override the default templates Sonata uses to render the admin UI:
sonata_admin:
templates:
list: SonataAdminBundle:CRUD:list.html.twig
inner_list_row: SonataAdminBundle:CRUD:list_inner_row.html.twig
...
list 模板负责呈现整个表格.
inner_list_row 负责呈现此表中的单行.
The list template is reponsible for rendering the whole table.
The inner_list_row is responsible for rendering a single row in this table.
实际上,list.html.twig
扩展了 base_list.html.twig
和 list_inner_row.html.twig
扩展 base_list_inner_row
,
所以你可能应该覆盖这四个.
Actually, list.html.twig
extends base_list.html.twig
and list_inner_row.html.twig
extends base_list_inner_row
,
so you should probably by overriding those four.
这篇关于修改 Sonata 中的列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!