How to remove "delete" button in default "Edit" form of sonata admin?

Viewed 9251

I wrote a code to list data taken from a simple database and there I put an action to edit data. When I click on this Edit button, it goes to the default "Edit" page. There is a button called "delete" there. I want to remove that button...

4 Answers

Firstly use the class RouteCollection in your CustomClassAdmin :

use Sonata\AdminBundle\Route\RouteCollection;

and add the following code:

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

Related