We just updated our project to symfony 4.4 and 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
Is there a way to configure the 4.5 admin bundle, so that we can jump straight to the entity edit view again?
CodePudding user response:
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
;
}
}
CodePudding user response:
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:
options:
default_admin_route: edit
skin: 'skin-black'