PHP Class ZenValidatorConstraint, silverstripe-zenvalidator

Author: ([email protected])
Inheritance: extends Object
显示文件 Open project: sheadawson/silverstripe-zenvalidator Class Usage Examples

Protected Properties

Property Type Description
$customMessage string
$field FormField
$parsleyApplied boolean

Public Methods

Method Description
applyParsley ( ) : void Sets the html attributes required for frontend validation Subclasses should call parent::applyParsley
getConstraintName ( ) : string Gets the name of this constraint from it's classname which should correspond to the string that parsley uses to identify a constraint type
getDefaultMessage ( ) : string Return the default message for this constraint
getField ( ) : FormField
getMessage ( ) : string Get's the message that was set on the constrctor or falls back to default
loadExtra ( string $name ) Load extra validator
removeParsley ( ) : void Removes the html attributes required for frontend validation Subclasses should call parent::removeParsley
setField ( FormField $field ) : this Set the field this constraint is applied to
setMessage ( string $message ) : this Set a custom message for this constraint
validate ( $value ) : boolean Performs php validation on the value

Method Details

applyParsley() public method

Sets the html attributes required for frontend validation Subclasses should call parent::applyParsley
public applyParsley ( ) : void
return void

getConstraintName() public method

Gets the name of this constraint from it's classname which should correspond to the string that parsley uses to identify a constraint type
public getConstraintName ( ) : string
return string

getDefaultMessage() abstract public method

Return the default message for this constraint
abstract public getDefaultMessage ( ) : string
return string

getField() public method

public getField ( ) : FormField
return FormField

getMessage() public method

Get's the message that was set on the constrctor or falls back to default
public getMessage ( ) : string
return string

loadExtra() public method

Load extra validator
public loadExtra ( string $name )
$name string

removeParsley() public method

Removes the html attributes required for frontend validation Subclasses should call parent::removeParsley
public removeParsley ( ) : void
return void

setField() public method

Set the field this constraint is applied to
public setField ( FormField $field ) : this
$field FormField
return this

setMessage() public method

Set a custom message for this constraint
public setMessage ( string $message ) : this
$message string
return this

validate() abstract public method

Performs php validation on the value
abstract public validate ( $value ) : boolean
$value
return boolean

Property Details

$customMessage protected_oe property

protected string $customMessage
return string

$field protected_oe property

protected FormField $field
return FormField

$parsleyApplied protected_oe property

protected bool $parsleyApplied
return boolean