简体   繁体   English

Sonata Admin Bundle 4.5 ListView:再次直接链接到 /edit 而不是 /show

[英]Sonata Admin Bundle 4.5 ListView: Link again directly to /edit instead of /show

We just updated our project to symfony 4.4 and Sonata Admin 4.5.我们刚刚将我们的项目更新为 symfony 4.4 和 Sonata Admin 4.5。 It works so far, but in the list view we are now directed to /[modelName]/[classId]/show instead of the old behaviour of ging directly to /[modelName]/[classId]/edit到目前为止它工作正常,但在列表视图中,我们现在被定向到/[modelName]/[classId]/show而不是直接转到/[modelName]/[classId]/edit的旧行为

Is there a way to configure the 4.5 admin bundle, so that we can jump straight to the entity edit view again?有没有办法配置 4.5 管理包,以便我们可以再次直接跳转到实体编辑视图?

Well, it turned out the documentation is our friend :)好吧,原来文档是我们的朋友:)

final class YourEntitiyAdmin extends AbstractAdmin
{
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->add('id')  
            ->addIdentifier('name', null, [
                'route' => [
                    'name' => 'edit' // <-- this changes from /show to /edit
                ]
            ])
            // whatever other field you want
            ;
    }
}

I had the same question 2 days ago !两天前我也有同样的问题! Instead of changing every Admin file you can just change the configuration in sonata_admin.yaml无需更改每个管理文件,您只需更改sonata_admin.yaml中的配置

sonata_admin:
    options:
        default_admin_route: edit
        skin: 'skin-black'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM