8

How can I disable the search feature in Sonata Admin Bundle, in order to not show the search input field in the upper menu?

Guillermo Gutiérrez
  • 17,273
  • 17
  • 89
  • 116

4 Answers4

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
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
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