PropertyModifierRejectOrSelect: match booleans
This commit is contained in:
parent
06b6356de1
commit
f2e6f86d8e
|
@ -17,6 +17,10 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
|
|||
return 'Black or White-list rows based on property value';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @throws \Zend_Form_Exception
|
||||
*/
|
||||
public static function addSettingsFormFields(QuickForm $form)
|
||||
{
|
||||
$form->addElement('select', 'filter_method', [
|
||||
|
@ -26,6 +30,8 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
|
|||
'multiOptions' => $form->optionalEnum([
|
||||
'wildcard' => $form->translate('Simple match with wildcards (*)'),
|
||||
'regex' => $form->translate('Regular Expression'),
|
||||
'is_true' => $form->translate('Match boolean TRUE'),
|
||||
'is_false' => $form->translate('Match boolean FALSE'),
|
||||
'is_null' => $form->translate('Match NULL value columns'),
|
||||
]),
|
||||
'class' => 'autosubmit',
|
||||
|
@ -66,6 +72,16 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
|
|||
return $string === null;
|
||||
}
|
||||
|
||||
public function isTrue($string, $expression)
|
||||
{
|
||||
return $string === true;
|
||||
}
|
||||
|
||||
public function isFalse($string, $expression)
|
||||
{
|
||||
return $string === false;
|
||||
}
|
||||
|
||||
public function matchesWildcard($string, $expression)
|
||||
{
|
||||
return $this->filterExpression->matches(
|
||||
|
@ -90,6 +106,12 @@ class PropertyModifierRejectOrSelect extends PropertyModifierHook
|
|||
case 'is_null':
|
||||
$func = 'isNull';
|
||||
break;
|
||||
case 'is_true':
|
||||
$func = 'isTrue';
|
||||
break;
|
||||
case 'is_false':
|
||||
$func = 'isFalse';
|
||||
break;
|
||||
default:
|
||||
throw new ConfigurationError(
|
||||
'%s is not a valid value for an ArrayFilter filter_method',
|
||||
|
|
Loading…
Reference in New Issue