PHP Класс ZenValidator, silverstripe-zenvalidator

Автор: ([email protected])
Наследование: extends Validator
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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