LLMS_Form_Validator::validate_field_attribute_minlength( string $posted_value, int $minlength, array $field )
Validates the html input minlength attribute
Description Description
Used by the User Password field.
Parameters Parameters
- $posted_value
-
(string) (Required) User-submitted value.
- $minlength
-
(int) (Required) The minimum string length as parsed from the field block.
- $field
-
(array) (Required) LifterLMS Form Field settings array.
Return Return
(WP_Error|boolean) Returns true for a valid value, otherwise an error.
Source Source
File: includes/forms/class-llms-form-validator.php
protected function validate_field_attribute_minlength( $posted_value, $minlength, $field ) {
if ( strlen( $posted_value ) < $minlength ) {
return new WP_Error(
'llms-form-field-invalid',
sprintf(
__( 'The %1$s must be at least %2$d characters in length.', 'lifterlms' ),
isset( $field['label'] ) ? $field['label'] : $field['name'],
$minlength
)
);
}
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |