PHP 클래스 yii\validators\FilterValidator
FilterValidator is actually not a validator but a data processor.
It invokes the specified filter callback to process the attribute value
and save the processed value back to the attribute. The filter must be
a valid PHP callback with the following signature:
php
function foo($value) {
compute $newValue here
return $newValue;
}
Many PHP functions qualify this signature (e.g.
trim()).
To specify the filter, set [[filter]] property to be the callback.
파일 보기
프로젝트 열기: yiisoft/yii2
1 사용 예제들
공개 프로퍼티들
프로퍼티 |
타입 |
설명 |
|
$filter |
|
the filter. This can be a global function name, anonymous function, etc.
The function signature must be as follows,
php
function foo($value) {
compute $newValue here
return $newValue;
}
|
|
$skipOnArray |
|
whether the filter should be skipped if an array input is given.
If true and an array input is given, the filter will not be applied. |
|
$skipOnEmpty |
|
this property is overwritten to be false so that this validator will
be applied when the value being validated is empty. |
|
공개 메소드들
메소드 상세
clientValidateAttribute()
공개 메소드
validateAttribute()
공개 메소드
프로퍼티 상세
the filter. This can be a global function name, anonymous function, etc.
The function signature must be as follows,
php
function foo($value) {
compute $newValue here
return $newValue;
}
whether the filter should be skipped if an array input is given.
If true and an array input is given, the filter will not be applied.
this property is overwritten to be false so that this validator will
be applied when the value being validated is empty.