How can I disable the search feature in Sonata Admin Bundle, in order to not show the search input field in the upper menu?
Asked
Active
Viewed 3,394 times
4 Answers
7
In Sonata Admin version >= 3.0 it's as simple as:
sonata_admin:
search: false
in your config/packages/sonata_admin.yaml
.

Mike Doe
- 16,349
- 11
- 65
- 88
-
1The cleanest solution on this post – HRoux Aug 22 '19 at 13:18
-
AFAIK there was no such option at the time. – Mike Doe Aug 22 '19 at 14:01
5
You need to override the standard_layout.html.twig template and overwrite the block sonata_top_bar_search with nothing in it. That will make it disappear.
sonata_admin:
templates:
layout: YourBundle::layout.html.twig
Read more here about customizing templates.

Geert Wille
- 1,656
- 13
- 18
-
1Thanks! I thought there will be a parameter or something similar, but this seems to be the only option so far. – Guillermo Gutiérrez Mar 19 '14 at 15:20
-
1As mentioned below by @monofone: "In later version (2.3+) ist the block sonata_sidebar_search that needs to be overwritten." – Ziad Akiki Sep 28 '17 at 12:38
5
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 %}

Cassiano
- 562
- 5
- 16
3
In later version (2.3+) ist the block sonata_sidebar_search that needs to be overwritten.

monofone
- 860
- 8
- 16