Disable Sonata Admin Search

How to disable the search function in the Sonata Admin Bundle so as not to display the search input field in the top menu?

+7
symfony sonata-admin symfony-sonata
source share
4 answers

You need to override the standard_layout.html.twig template and overwrite the sonata_top_bar_search block, nothing in it. This will make him disappear.

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

Read more about setting up templates.

+6
source share

Just complementing the answers here, the complete solution:

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 %} 
+4
source share

In a later version (2.3+), there is a sonata_sidebar_search block that needs to be rewritten.

+3
source share

In Sonata Admin v3, it is as simple as:

 sonata_admin: search: false 
0
source share

All Articles