Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

symfony 2 sonataAdminBundle override template

how can we override sonata bundle layout for a single Admin class like i have created 3 Admin Class userAdmin, productAdmin, ticketAdmin now i want to override ticketAdmin edit action and edit template and add some extra code there.

like image 366
Anil Gupta Avatar asked Apr 24 '12 12:04

Anil Gupta


1 Answers

You can use :

Controller :

custom action in SonataAdminBundle

Template :

// in your admin class
public function getTemplate($name)
{
    switch ($name) {
        case 'edit':
            return 'AcmeMyBundle::my-custom-edit.html.twig';
            break;
        default:
            return parent::getTemplate($name);
            break;
    }
}
like image 191
Dimitri Avatar answered Oct 06 '22 01:10

Dimitri