Validator
class Validator (View source)
Form validation for configuration editor
Validation function takes two argument: id for which it is called and array of fields' values (usually values for entire formset). The function must always return an array with an error (or error array) assigned to a form element (formset name or field path). Even if there are no errors, key must be set with an empty value.
Validation functions are assigned in $cfg_db['_validators'] (config.values.php).
Methods
Runs validation $validator_id on values $values and returns error list.
Details
static array
getValidators(ConfigFile $cf)
Returns validator list
static bool|array
validate(ConfigFile $cf, string|array $validatorId, array $values, bool $isPostSource)
Runs validation $validator_id on values $values and returns error list.
Return values: o array, keys - field path or formset id, values - array of errors when $isPostSource is true values is an empty array to allow for error list cleanup in HTML document o false - when no validators match name(s) given by $validator_id