2014-03-18 61 views

回答

6

你需要重寫standard_layout.html.twig模板,並沒有在它覆蓋塊sonata_top_bar_search。這會使它消失。

sonata_admin: 
    templates: 
     layout: YourBundle::layout.html.twig 

閱讀全文here關於自定義模板。

+1

謝謝!我認爲會有一個參數或類似的東西,但這似乎是目前唯一的選擇。 –

+0

@monofone如下所述:「在後來的版本(2.3+)中,需要覆蓋的塊sonata_sidebar_search。」 –

3

在以後的版本(2.3+)ist塊sonata_sidebar_search需要被覆蓋。

+1

這更適合作爲對答案的評論。 – EWit

+0

是的,你是對的,但我不能評論聲譽。 – monofone

2

這裏只是補充了答案,完整的解決方案:

config.yml

sonata_admin: 
    templates: 
     layout: AppBundle::layout.html.twig 

的appbundle :: layout.html.twig

{% extends 'SonataAdminBundle::standard_layout.html.twig' %} 

{% block sonata_sidebar_search %} 
{% endblock sonata_sidebar_search %}