Skip to content

Commit ec5a20a

Browse files
committed
Add sql: filtering mode
1 parent 0d489a5 commit ec5a20a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fields/field.textbox.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,17 @@ public function fetchFilterableOperators()
808808
'filter' => 'not-handle:',
809809
'help' => __('Find values by exact exclusion of their handle representation only.')
810810
),
811+
812+
array(
813+
'filter' => 'sql: NOT NULL',
814+
'title' => 'is not empty',
815+
'help' => __('Find entries with a non-empty value.')
816+
),
817+
array(
818+
'filter' => 'sql: NULL',
819+
'title' => 'is empty',
820+
'help' => __('Find entries with an empty value.')
821+
),
811822
);
812823
}
813824

@@ -840,6 +851,10 @@ public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = fal
840851
$this->buildRegexSQL($data[0], array('value', 'handle'), $joins, $where);
841852
}
842853

854+
if (self::isFilterSQL($data[0])) {
855+
$this->buildFilterSQL($data[0], array('value', 'handle'), $joins, $where);
856+
}
857+
843858
else if (preg_match('/^(not-)?boolean:\s*/', $data[0], $matches)) {
844859
$data = trim(array_pop(explode(':', implode(' + ', $data), 2)));
845860
$negate = ($matches[1] == '' ? '' : 'NOT');

0 commit comments

Comments
 (0)