mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Add config to force legacy filter header globally
This commit is contained in:
parent
b47d9abd7c
commit
d879148bff
@ -26,6 +26,12 @@ To enable the legacy search API on a `GridFieldFilterHeader`, you can either:
|
||||
* set the `useLegacyFilterHeader` property to `true`,
|
||||
* or pass `true` to the first argument of its constructor.
|
||||
|
||||
To force the legacy search API on all instances of `GridFieldFilterHeader`, you can set it in your [configuration file](../../configuration):
|
||||
```yml
|
||||
SilverStripe\Forms\GridField\GridFieldFilterHeader:
|
||||
force_legacy: true
|
||||
```
|
||||
|
||||
```php
|
||||
public function getCMSFields()
|
||||
{
|
||||
|
@ -6,6 +6,7 @@ use LogicException;
|
||||
use SilverStripe\Admin\LeftAndMain;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Forms\FieldGroup;
|
||||
@ -43,6 +44,16 @@ class GridFieldFilterHeader implements GridField_URLHandler, GridField_HTMLProvi
|
||||
*/
|
||||
public $useLegacyFilterHeader = false;
|
||||
|
||||
/**
|
||||
* Forces all filter components to revert to displaying the legacy
|
||||
* table header style rather than the react driven search box
|
||||
*
|
||||
* @deprecated 4.3.0:5.0.0 Will be removed in 5.0
|
||||
* @config
|
||||
* @var bool
|
||||
*/
|
||||
private static $force_legacy = false;
|
||||
|
||||
/**
|
||||
* @var \SilverStripe\ORM\Search\SearchContext
|
||||
*/
|
||||
@ -76,7 +87,7 @@ class GridFieldFilterHeader implements GridField_URLHandler, GridField_HTMLProvi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $useLegacy
|
||||
* @param bool $useLegacy This will be removed in 5.0
|
||||
* @param callable|null $updateSearchContext This will be removed in 5.0
|
||||
* @param callable|null $updateSearchForm This will be removed in 5.0
|
||||
*/
|
||||
@ -85,7 +96,7 @@ class GridFieldFilterHeader implements GridField_URLHandler, GridField_HTMLProvi
|
||||
callable $updateSearchContext = null,
|
||||
callable $updateSearchForm = null
|
||||
) {
|
||||
$this->useLegacyFilterHeader = $useLegacy;
|
||||
$this->useLegacyFilterHeader = Config::inst()->get(self::class, 'force_legacy') || $useLegacy;
|
||||
$this->updateSearchContextCallback = $updateSearchContext;
|
||||
$this->updateSearchFormCallback = $updateSearchForm;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user