2014-09-01 41 views

回答

3

您必須定義新的模板以及被覆蓋的具體操作。

的機制的文檔在這裏提供了一個有用的例子:

http://sonata-project.org/bundles/admin/2-2/doc/reference/action_show.html#setting-up-a-custom-show-template-very-useful

sonata_admin: 
    title: Acme 
    title_logo: public/img/logo.png 
    options: 
     title_mode: 'single_image' 
    templates: 
     # default global templates 
     layout: :sonata:standard_layout.html.twig 
     ajax: SonataAdminBundle::ajax_layout.html.twig 
     dashboard: SonataAdminBundle:Core:dashboard.html.twig 

     # default actions templates, should extend a global templates 
     list:  SonataAdminBundle:CRUD:list.html.twig 
     show:  SonataAdminBundle:CRUD:show.html.twig 
     edit:  SonataAdminBundle:CRUD:edit.html.twig 
     user_block: acmeUserBundle:Core:user_block.html.twig 

一個更加全球化的DOC:

http://sonata-project.org/bundles/admin/2-2/doc/reference/templates.html

2

如果要覆蓋一個管理模板(編輯在下面的例子中)

app.admin.foo: 
    class: AppBundle\Admin\FooAdmin 
    arguments: [~, AppBundle\Entity\Foo, AppBundle:FooAdmin] 
    tags: 
     - { name: sonata.admin, manager_type: orm, group: admin, label: Foo } 
    calls: 
     - [ setTemplate, ['edit', 'AppBundle:Admin/Foo/CRUD:edit.html.twig']]