PropertyModifierRejectOrSelect: add dedicated NULL

...support

refs #1371
This commit is contained in:
Thomas Gelf 2018-01-26 13:10:18 +01:00
parent 3a1d09cfb1
commit dba98b7c3f
1 changed files with 10 additions and 0 deletions

View File

@ -26,7 +26,9 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
'multiOptions' => $form->optionalEnum([ 'multiOptions' => $form->optionalEnum([
'wildcard' => $form->translate('Simple match with wildcards (*)'), 'wildcard' => $form->translate('Simple match with wildcards (*)'),
'regex' => $form->translate('Regular Expression'), 'regex' => $form->translate('Regular Expression'),
'is_null' => $form->translate('Match NULL value columns'),
]), ]),
'class' => 'autosubmit',
]); ]);
$form->addElement('text', 'filter_string', [ $form->addElement('text', 'filter_string', [
@ -59,6 +61,11 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
return preg_match($expression, $string); return preg_match($expression, $string);
} }
public function isNull($string, $expression)
{
return $string === null;
}
public function matchesWildcard($string, $expression) public function matchesWildcard($string, $expression)
{ {
return $this->filterExpression->matches( return $this->filterExpression->matches(
@ -80,6 +87,9 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
case 'regex': case 'regex':
$func = 'matchesRegexp'; $func = 'matchesRegexp';
break; break;
case 'is_null':
$func = 'isNull';
break;
default: default:
throw new ConfigurationError( throw new ConfigurationError(
'%s is not a valid value for an ArrayFilter filter_method', '%s is not a valid value for an ArrayFilter filter_method',