+ const validator = (control: AbstractControl): ValidationErrors | null => {
+ if (!setting.commonOptions.error) return null
+
+ const error = setting.commonOptions.error({ formValues: this.form.value, value: control.value })
+
+ return error?.error ? { [setting.commonOptions.name]: error.text } : null
+ }
+
+ const name = setting.commonOptions.name
+
+ pluginObj[name] = {
+ VALIDATORS: [ validator ],
+ MESSAGES: {}
+ }
+
+ pluginDefaults[name] = setting.commonOptions.default