简体   繁体   English

Symfony2 - 覆盖模板包

[英]Symfony2 - override template bundle

I want to override the default SonataAdmin Template.我想覆盖默认的 SonataAdmin 模板。

I create a standard_layout.html.twig in my Namespace/bundle/resources/views (same structur, same file name, same content)我在我的 Namespace/bundle/resources/views(相同的结构,相同的文件名,相同的内容)中创建了一个 standard_layout.html.twig

I copied all the content of the source template in my target template, i just edit some part of the target off course....and nothing我在目标模板中复制了源模板的所有内容,我只是在课程之外编辑了目标的某些部分....什么也没有

thanks for your help Bye谢谢你的帮助再见

You have the solution of bundle heritance http://symfony.com/doc/current/cookbook/bundles/inheritance.html which allows, not only override templates but methods too.您有捆绑继承http://symfony.com/doc/current/cookbook/bundles/inheritance.html的解决方案,它不仅可以覆盖模板,还可以覆盖方法。

Or you have http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates which focusing only on templates.或者你有http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates只关注模板。

With this last, you can try to create :最后,您可以尝试创建:

app/Resources/SonataAdminBundle/views/CRUD/base_show_field.html.twig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM