2016-07-28 186 views
2

如何在新版本中覆盖“演示”模板?之前我在模板库中的模板扩展:如何在新版本奏鸣曲“显示”模板管理员

{% extends 'SonataAdminBundle:CRUD:base_show.html.twig' %} 

,并覆盖

{% block show_field %} my content {% endblock %}. 

但现在这行不通。我现在需要扩展哪些模板?

PS我想只有一个实体覆盖模板,这样,全球覆盖不适合我

回答

0

尝试,如果base_show_macro模板是你在找什么:

vendor/sonata-project/admin-bundle/Resources/views/CRUD/base_show_macro.html.twig 

或树枝:

{% extends 'SonataAdminBundle:CRUD:base_show_macro.html.twig' %} 
+0

没有这个不行,因为base_show_macro不能扩展base_show。 base_show_macro.html.twig在变量show_helper [代码](https://github.com/sonata-project/SonataAdminBundle/blob/3.x/Resources/views/CRUD/base_show.html.twig#L14)中显示并呈现在一些地方[代码](https://github.com/sonata-project/SonataAdminBundle/blob/3.x/Resources/views/CRUD/base_show.html.twig#L59)。在此块show_field在base_show [code](https://github.com/sonata-project/SonataAdminBundle/commit/fd1a1596f86bfb4afdafe9767efaa4c787bba6a5#diff-0cb97fb894cd897069cbade4ba839c97L36) –

相关问题