Skip to content

Conversation

@MrEssex
Copy link
Member

@MrEssex MrEssex commented Aug 7, 2025

Now supports a Dictionary (if passed through).

The validator will serialise with a new field 'd' e.g. {'d': {'invalid': 'Required'}} this will then be used as the error message in JS.
The reason for this is so we can create, for example RequiredValidator::withDictionary([RequiredValidation::DICT_INV -> "Translated Error Message"]) in PHP and also have the translated message in JS.

If you don't overwrite all the keys, that's fine it array merges so it has fallback.
Can still be used standalone as the JS fallbacks to the original if there is no Dictionary.
Can still be used as before simply calling new RequiredValidator()

@bajb bajb merged commit c83bb1e into packaged:master Aug 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants