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.
Показать файл
Открыть проект
Примеры использования класса
Открытые свойства
Свойство |
Тип |
Описание |
|
$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()
публичный Метод
Описание свойств
$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.