Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan DJ committed Aug 14, 2020
1 parent d04df06 commit b9266f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,23 @@ Custom filters collection for Silverstripe Model Admin GridField.
extensions:
- Heyday\ModelAdminFilter\FilterExtension
```

- In your model admin, add this function:
```
/**
* {@inheritdoc}
*/
public function getList()
{
$list = parent::getList();
$list = $this->getFilteredList($list);
return $list;
}
```

`getFilteredList` will return filtered list from custom filter.

- Also in your model admin, add this function to add custom filter fields:
```
/**
* List of ModelAdminFilter custom fields
Expand Down
2 changes: 1 addition & 1 deletion src/FilterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getFilterParams(): array
/**
* Update model admin list based on param
*/
public function updateList(DataList $list)
public function getFilteredList(DataList $list)
{
// get search params
$params = $this->getFilterParams();
Expand Down

0 comments on commit b9266f3

Please sign in to comment.