Faloude Faloude - 1 year ago 120
PHP Question

SilverStripe remove ModelAdmin search

Is there a way to remove the search functionality for


For now I'm using CSS, but there should be a better solution.

#filters-button {
display: none;

Answer Source

WE talked on IRC, but just for the record let me put this out here:

There has always been the possibility to overwrite public function SearchForm() { return false; } and therefore remove the form. This however does not effect the #filters-button (3.4) or the sidebar (3.0-3.3).
So at this time, you do have to use CSS.

I have however just created a Pull Request to implement $showSearchForm which would work the same way as $showImportForm.


This will probably be merged into 3.4.2, once that is in you can do:

class FooBarAdmin extends ModelAdmin {
    private static $url_segment = 'foobar';
    private static $managed_models = ['Foo', 'Bar'];
    public $showImportForm = false;
    public $showSeachForm = false;
    # or if you just want to disable seach for Foo but not Bar:
    #public $showSeachForm = ['Bar'];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download