Question

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

Was it helpful?

Solution 2

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.

OTHER TIPS

In Sonata Admin version >= 3.0 it's as simple as:

sonata_admin:
    search: false

in your config/packages/sonata_admin.yaml.

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

In later version (2.3+) ist the block sonata_sidebar_search that needs to be overwritten.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top