From 1766e371772cfc54e69d8f5b5cd58f79280a4305 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 22 Oct 2024 10:38:39 +0000 Subject: [PATCH] Dev: Column Search lib --- Editor/ColumnSearch.php | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Editor/ColumnSearch.php diff --git a/Editor/ColumnSearch.php b/Editor/ColumnSearch.php new file mode 100644 index 0000000..e999125 --- /dev/null +++ b/Editor/ColumnSearch.php @@ -0,0 +1,45 @@ +where($field->dbField(), $searchTerm); + } + + return true; + } else if ($colSearch['type'] === 'dateRange') { + if ($searchTerm) { + $parts = explode('|', $searchTerm); + + if ($parts[0]) { + $query->where($field->dbField(), $parts[0], '>='); + } + + if ($parts[1]) { + $query->where($field->dbField(), $parts[1], '<='); + } + } + + return true; + } + + // Text fields can get the default handling + return false; + } +}