From 8e83ec5c65ea4083b217d6b30bbb788bb9861f6d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 9 Dec 2024 17:04:40 +0100 Subject: [PATCH] Add filter for object ids --- .../gridView/filter/ObjectIdFilter.class.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/gridView/filter/ObjectIdFilter.class.php diff --git a/wcfsetup/install/files/lib/system/gridView/filter/ObjectIdFilter.class.php b/wcfsetup/install/files/lib/system/gridView/filter/ObjectIdFilter.class.php new file mode 100644 index 0000000000..501026b20b --- /dev/null +++ b/wcfsetup/install/files/lib/system/gridView/filter/ObjectIdFilter.class.php @@ -0,0 +1,45 @@ + + * @since 6.2 + */ +class ObjectIdFilter implements IGridViewFilter +{ + #[\Override] + public function getFormField(string $id, string $label): AbstractFormField + { + return IntegerFormField::create($id) + ->label($label) + ->minimum(1) + ->nullable(); + } + + #[\Override] + public function applyFilter(DatabaseObjectList $list, string $id, string $value): void + { + $list->getConditionBuilder()->add("$id = ?", [$value]); + } + + #[\Override] + public function matches(string $filterValue, string $rowValue): bool + { + return $filterValue == $rowValue; + } + + #[\Override] + public function renderValue(string $value): string + { + return $value; + } +} -- 2.20.1