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