PHP 클래스 ZenValidator, silverstripe-zenvalidator

저자: ([email protected])
상속: extends Validator
파일 보기 프로젝트 열기: sheadawson/silverstripe-zenvalidator 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$constraints array constraints assigned to this validator
$defaultJS boolean
$parsleyEnabled boolean

공개 메소드들

메소드 설명
__construct ( array $constraints = [], boolean $parsleyEnabled = true, boolean $defaultJS = null )
addRequiredFields ( $fields ) : this A quick way of adding required constraints to a number of fields
applyParsley ( ) applyParsley
disableParsley ( ) : this disableParsley
fieldIsRequired ( string $fieldName ) : boolean Returns whether the field in question is required. This will usually display '*' next to the field.
getConstraint ( string $fieldName, string $constraintName ) : ZenValidatorConstraint get a constraint by fieldName, constraintName
getConstraints ( string $fieldName ) : array get constraints by fieldName
parsleyIsEnabled ( ) : boolean parsleyIsEnabled
php ( $data ) : boolean Performs the php validation on all ZenValidatorConstraints attached to this validator
removeAllValidation ( ) Removes all constraints from this validator.
removeConstraint ( $fieldName, string $constraintName ) remove a constraint from a field
removeConstraints ( $fieldName ) remove all constraints from a field
removeValidation ( ) This method is not imeplemented because form->transform calls it, but not all FormTransformations necessarily want to remove validation.
setConstraint ( $fieldName, ZenFieldValidator $constraint ) setConstraint - sets a ZenValidatorContraint on this validator
setConstraints ( array $constraints ) setConstraints - sets multiple constraints on this validator
setForm ( Form $form )

메소드 상세

__construct() 공개 메소드

public __construct ( array $constraints = [], boolean $parsleyEnabled = true, boolean $defaultJS = null )
$constraints array
$parsleyEnabled boolean (default: true)
$defaultJS boolean (default: null)

addRequiredFields() 공개 메소드

A quick way of adding required constraints to a number of fields
public addRequiredFields ( $fields ) : this
리턴 this

applyParsley() 공개 메소드

applyParsley
public applyParsley ( )

disableParsley() 공개 메소드

disableParsley
public disableParsley ( ) : this
리턴 this

fieldIsRequired() 공개 메소드

Returns whether the field in question is required. This will usually display '*' next to the field.
public fieldIsRequired ( string $fieldName ) : boolean
$fieldName string
리턴 boolean

getConstraint() 공개 메소드

get a constraint by fieldName, constraintName
public getConstraint ( string $fieldName, string $constraintName ) : ZenValidatorConstraint
$fieldName string
$constraintName string
리턴 ZenValidatorConstraint

getConstraints() 공개 메소드

get constraints by fieldName
public getConstraints ( string $fieldName ) : array
$fieldName string
리턴 array

parsleyIsEnabled() 공개 메소드

parsleyIsEnabled
public parsleyIsEnabled ( ) : boolean
리턴 boolean

php() 공개 메소드

Performs the php validation on all ZenValidatorConstraints attached to this validator
public php ( $data ) : boolean
리턴 boolean

removeAllValidation() 공개 메소드

Removes all constraints from this validator.
public removeAllValidation ( )

removeConstraint() 공개 메소드

remove a constraint from a field
public removeConstraint ( $fieldName, string $constraintName )
$constraintName string - class name of constraint

removeConstraints() 공개 메소드

remove all constraints from a field
public removeConstraints ( $fieldName )

removeValidation() 공개 메소드

.. right? Use removeAllValidation() instead.
public removeValidation ( )

setConstraint() 공개 메소드

setConstraint - sets a ZenValidatorContraint on this validator
public setConstraint ( $fieldName, ZenFieldValidator $constraint )
$constraint ZenFieldValidator

setConstraints() 공개 메소드

setConstraints - sets multiple constraints on this validator
public setConstraints ( array $constraints )
$constraints array - $fieldName => ZenValidatorConstraint

setForm() 공개 메소드

public setForm ( Form $form )
$form Form

프로퍼티 상세

$constraints 보호되어 있는 프로퍼티

constraints assigned to this validator
protected array $constraints
리턴 array

$defaultJS 보호되어 있는 프로퍼티

protected bool $defaultJS
리턴 boolean

$parsleyEnabled 보호되어 있는 프로퍼티

protected bool $parsleyEnabled
리턴 boolean