1 | <?php |
||
19 | class BaseElement extends \Fiv\Form\Element\Html { |
||
20 | |||
21 | /** |
||
22 | * @var null|boolean |
||
23 | */ |
||
24 | protected $validationResult = null; |
||
25 | |||
26 | /** |
||
27 | * @var \Fiv\Form\Validator\Base[] |
||
28 | */ |
||
29 | protected $validators = []; |
||
30 | |||
31 | /** |
||
32 | * @var \Fiv\Form\Filter\FilterInterface[] |
||
33 | */ |
||
34 | protected $filters = []; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $text = ''; |
||
40 | |||
41 | /** |
||
42 | * @var null|string |
||
43 | */ |
||
44 | protected $value = null; |
||
45 | |||
46 | |||
47 | /** |
||
48 | * Attach validator to current element |
||
49 | * |
||
50 | * @deprecated |
||
51 | * @see addValidators |
||
52 | * |
||
53 | * @param \Fiv\Form\Validator\ValidatorInterface[]|\Fiv\Form\Validator\ValidatorInterface $validator |
||
54 | * @throws \Exception |
||
55 | * @return $this |
||
56 | */ |
||
57 | 6 | public function addValidator($validator) { |
|
64 | |||
65 | |||
66 | /** |
||
67 | * Attach validators to current element |
||
68 | * |
||
69 | * @param ValidatorInterface[] $validators |
||
70 | * @return $this |
||
71 | * @throws \Exception |
||
72 | */ |
||
73 | 6 | public function addValidators(array $validators) { |
|
85 | |||
86 | |||
87 | /** |
||
88 | * @deprecated |
||
89 | * @see addFilters |
||
90 | * |
||
91 | * @param \Fiv\Form\Filter\FilterInterface|\Fiv\Form\Filter\FilterInterface[] $filter |
||
92 | * @throws \Exception |
||
93 | * @return $this |
||
94 | */ |
||
95 | 3 | public function addFilter($filter) { |
|
102 | |||
103 | |||
104 | /** |
||
105 | * Attach filters to current element |
||
106 | * |
||
107 | * @param FilterInterface[] $filters |
||
108 | * @return $this |
||
109 | * @throws \Exception |
||
110 | */ |
||
111 | 3 | public function addFilters(array $filters) { |
|
121 | |||
122 | |||
123 | /** |
||
124 | * @param string $text |
||
125 | * @return $this |
||
126 | */ |
||
127 | 10 | public function setText($text) { |
|
131 | |||
132 | |||
133 | /** |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function getText() { |
||
139 | |||
140 | |||
141 | /** |
||
142 | * Alias of setAttribute('value', $value) |
||
143 | * |
||
144 | * @param $value |
||
145 | * @return $this |
||
146 | */ |
||
147 | 2 | public function setValue($value) { |
|
151 | |||
152 | |||
153 | /** |
||
154 | * @inheritdoc |
||
155 | */ |
||
156 | 18 | public function setAttribute($name, $value) { |
|
172 | |||
173 | |||
174 | /** |
||
175 | * @return \Fiv\Form\Filter\FilterInterface[] |
||
176 | */ |
||
177 | 16 | public function getFilters() { |
|
180 | |||
181 | |||
182 | /** |
||
183 | * Return true if element is valid |
||
184 | * @return boolean |
||
185 | */ |
||
186 | 8 | public function validate() { |
|
203 | |||
204 | |||
205 | /** |
||
206 | * @return string |
||
207 | */ |
||
208 | 14 | public function getValue() { |
|
211 | |||
212 | |||
213 | /** |
||
214 | * @return \Fiv\Form\Validator\Base[] |
||
215 | */ |
||
216 | 8 | public function getValidators() { |
|
219 | |||
220 | |||
221 | /** |
||
222 | * @inheritdoc |
||
223 | */ |
||
224 | 3 | public function render() { |
|
229 | |||
230 | |||
231 | /** |
||
232 | * @return array |
||
233 | */ |
||
234 | public function getValidatorsErrors() { |
||
242 | |||
243 | |||
244 | /** |
||
245 | * @deprecated use addValidator(new \Fiv\Form\Validator\Required()) instead |
||
246 | * @see addValidator |
||
247 | * @return $this |
||
248 | */ |
||
249 | public function required() { |
||
253 | } |
This method has been deprecated.