【发布时间】:2016-10-26 09:49:53
【问题描述】:
有没有办法删除ModelAdmin 页面的搜索功能?
目前我正在使用 CSS,但应该有更好的解决方案。
#filters-button {
display: none;
}
【问题讨论】:
标签: php silverstripe
有没有办法删除ModelAdmin 页面的搜索功能?
目前我正在使用 CSS,但应该有更好的解决方案。
#filters-button {
display: none;
}
【问题讨论】:
标签: php silverstripe
我们在 IRC 上进行了讨论,但为了记录,让我把它放在这里:
一直有可能覆盖public function SearchForm() { return false; } 并因此删除表单。但是,这不会影响 #filters-button (3.4) 或侧边栏 (3.0-3.3)。
所以这个时候,你确实必须使用 CSS。
然而,我刚刚创建了一个拉取请求来实现$showSearchForm,它的工作方式与$showImportForm 相同。
https://github.com/silverstripe/silverstripe-framework/pull/6237
https://github.com/silverstripe/silverstripe-framework/pull/6309(重新提出拉取请求)
这可能会被合并到 3.4.2 3.5.0 中,一旦你可以这样做:
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'];
}
【讨论】: