Open nliautaud opened 6 years ago
The "fields lists" settings would be replaced by "fields rules" where blacklist/whitelist is renamed to "should match" and "shouldn't match" and the content would be a regex capture group, like :
first|second|third
The code would be something like
$rule = array_filter($this->form->config('rules'), function($rule) { return $rule->field_type == $this->type; }); if (!$rule || empty($rule->regex)) return; $pattern = "`({$rule->regex})`"; $found = preg_match($pattern, $this->value); return ($found && $rule->not) || (!$found && !$rule->not);
Instead of
https://github.com/nliautaud/p01contact/blob/46250518568fe07a97206b68a8c874ad9cac1adb/p01-contact/src/P01contact_Field.php#L161-L180
The "fields lists" settings would be replaced by "fields rules" where blacklist/whitelist is renamed to "should match" and "shouldn't match" and the content would be a regex capture group, like :
The code would be something like
Instead of
https://github.com/nliautaud/p01contact/blob/46250518568fe07a97206b68a8c874ad9cac1adb/p01-contact/src/P01contact_Field.php#L161-L180