- edited description
Add ability to override exception messages thrown in validation methods
Issue #2
resolved
Currently, you can override just the main error message for a validation method but Exceptions provide a way to display error-specific messages which cannot be overridden.
Example syntax:
field_name.validation_rule[.exception_code]
( [] optional )
Resulting use:
Carbon_Validator::register_default_error_message('file', 'Please upload a file in the "%1$s" field.');
Carbon_Validator::register_default_error_message('file.1', 'Please upload an image file for your avatar.');
$strings = array(
'avatar.file'=>'Please upload a file in the "%1$s" field.',
'avatar.file.1'=>'Please upload an image file for your avatar.',
);
In addition, it may be better for Carbon_Validator::register_default_error_message
to accept a callback which returns a string as well.
Comments (3)
-
reporter -
reporter Abort in favor of not throwing exceptions in built-in validations and making required work with files instead (if it doesn't already).
Also, references to self:: are present in built-in validation methods which must be removed.
-
repo owner - changed status to resolved
Fixed in pull request #4
- Log in to comment