1 | <?php |
||
26 | class InlineValidator extends Validator |
||
27 | { |
||
28 | /** |
||
29 | * @var string|\Closure an anonymous function or the name of a model class method that will be |
||
30 | * called to perform the actual validation. The signature of the method should be like the following: |
||
31 | * |
||
32 | * ```php |
||
33 | * function foo($attribute, $params, $validator) |
||
34 | * ``` |
||
35 | * |
||
36 | * - `$attribute` is the name of the attribute to be validated; |
||
37 | * - `$params` contains the value of [[params]] that you specify when declaring the inline validation rule; |
||
38 | * - `$validator` is a reference to related [[InlineValidator]] object. |
||
39 | */ |
||
40 | public $method; |
||
41 | /** |
||
42 | * @var mixed additional parameters that are passed to the validation method |
||
43 | */ |
||
44 | public $params; |
||
45 | /** |
||
46 | * @var string|\Closure an anonymous function or the name of a model class method that returns the client validation code. |
||
47 | * The signature of the method should be like the following: |
||
48 | * |
||
49 | * ```php |
||
50 | * function foo($attribute, $params, $validator) |
||
51 | * { |
||
52 | * return "javascript"; |
||
53 | * } |
||
54 | * ``` |
||
55 | * |
||
56 | * where `$attribute` refers to the attribute name to be validated. |
||
57 | * |
||
58 | * Please refer to [[clientValidateAttribute()]] for details on how to return client validation code. |
||
59 | */ |
||
60 | public $clientValidate; |
||
61 | |||
62 | |||
63 | /** |
||
64 | * @inheritdoc |
||
65 | */ |
||
66 | 1 | public function validateAttribute($model, $attribute) |
|
74 | |||
75 | /** |
||
76 | * @inheritdoc |
||
77 | */ |
||
78 | 1 | public function clientValidateAttribute($model, $attribute, $view) |
|
91 | } |
||
92 |