Skip to content

Commit 38b94dd

Browse files
committed
Document list view filters
1 parent 13a5f7f commit 38b94dd

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

docs/php/api/list_views.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,93 @@ class ExampleListView extends AbstractListView
156156
}
157157
```
158158

159+
### BooleanFilter
160+
161+
`BooleanFilter` is a filter for columns that contain boolean values (`1` or `0`).
162+
163+
### CategoryFilter
164+
165+
`CategoryFilter` is a filter for columns that contain category ids.
166+
167+
```php
168+
class ExampleListView extends AbstractListView
169+
{
170+
public function __construct()
171+
{
172+
$this->addAvailableFilters([
173+
new CategoryFilter((new CategoryNodeTree('identifier'))->getIterator()), 'categoryID'),
174+
]);
175+
}
176+
}
177+
```
178+
179+
### DateFilter
180+
181+
`DateFilter` is a filter for columns that contain unix timestamps.
182+
183+
### LabelFilter
184+
185+
`LabelFilter` allows to filter a list view by labels.
186+
187+
```php
188+
class ExampleListView extends AbstractListView
189+
{
190+
public function __construct()
191+
{
192+
$objectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName(
193+
'com.woltlab.wcf.label.object',
194+
'example.identifier'
195+
);
196+
197+
foreach (ExampleCategory::getAccessibleLabelGroups('canViewLabel') as $groupID => $categoryIDs) {
198+
$this->addAvailableFilters([
199+
new LabelFilter(
200+
LabelHandler::getInstance()->getLabelGroup($groupID),
201+
$objectTypeID,
202+
'labelIDs' . $groupID
203+
)
204+
]);
205+
}
206+
}
207+
}
208+
```
209+
210+
### NumericFilter
211+
212+
`NumericFilter` is a filter for columns that contain numeric values.
213+
214+
### SelectFilter
215+
216+
`SelectFilter` allows a column to be filtered on the basis of a select dropdown.
217+
218+
```php
219+
class ExampleListView extends AbstractListView
220+
{
221+
public function __construct()
222+
{
223+
$this->addAvailableFilters([
224+
new SelectFilter([
225+
1 => 'value 1',
226+
0 => 'value 0',
227+
], 'id', 'language.item'),
228+
]);
229+
}
230+
}
231+
```
232+
233+
### TextFilter
234+
235+
`TextFilter` is a filter for text columns.
236+
237+
### TimeFilter
238+
239+
`TimeFilter` is a filter for columns that contain unix timestamps.
240+
In contrast to `DateFilter`, this filter also allows filtering by a specific time.
241+
242+
### UserFilter
243+
244+
`UserFilter` is a filter for columns that contain user ids.
245+
159246
## Customization
160247

161248
### Number of Items

0 commit comments

Comments
 (0)