1 | <?php |
||
14 | class BaseElement extends \Fiv\Form\Element\Html { |
||
15 | |||
16 | /** |
||
17 | * @var null|boolean |
||
18 | */ |
||
19 | protected $validationResult = null; |
||
20 | |||
21 | /** |
||
22 | * @var \Fiv\Form\Validator\Base[] |
||
23 | */ |
||
24 | protected $validators = []; |
||
25 | |||
26 | /** |
||
27 | * @var FilterInterface[] |
||
28 | */ |
||
29 | protected $filters = []; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $text = ''; |
||
35 | |||
36 | /** |
||
37 | * @var null|string |
||
38 | */ |
||
39 | protected $value = null; |
||
40 | |||
41 | |||
42 | /** |
||
43 | * Attach validator to current element |
||
44 | * |
||
45 | * @param ValidatorInterface $validator |
||
46 | * @return $this |
||
47 | */ |
||
48 | 6 | public function addValidator(ValidatorInterface $validator) { |
|
52 | |||
53 | |||
54 | /** |
||
55 | * @return \Fiv\Form\Validator\Base[] |
||
56 | */ |
||
57 | 8 | public function getValidators() { |
|
60 | |||
61 | |||
62 | /** |
||
63 | * |
||
64 | * @param FilterInterface $filter |
||
65 | * @throws \Exception |
||
66 | * @return $this |
||
67 | */ |
||
68 | 3 | public function addFilter(FilterInterface $filter) { |
|
72 | |||
73 | |||
74 | /** |
||
75 | * @return FilterInterface[] |
||
76 | */ |
||
77 | 16 | public function getFilters() { |
|
80 | |||
81 | |||
82 | /** |
||
83 | * Alias of setAttribute('value', $value) |
||
84 | * |
||
85 | * @param $value |
||
86 | * @return $this |
||
87 | */ |
||
88 | 2 | public function setValue($value) { |
|
92 | |||
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | 14 | public function getValue() { |
|
100 | |||
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | 18 | public function setAttribute($name, $value) { |
|
121 | |||
122 | |||
123 | /** |
||
124 | * Return true if element is valid |
||
125 | * @return boolean |
||
126 | */ |
||
127 | 8 | public function validate() { |
|
144 | |||
145 | |||
146 | /** |
||
147 | * @return array |
||
148 | */ |
||
149 | public function getValidatorsErrors() { |
||
157 | |||
158 | |||
159 | /** |
||
160 | * @inheritdoc |
||
161 | */ |
||
162 | 3 | public function render() { |
|
167 | |||
168 | |||
169 | /** |
||
170 | * @deprecated |
||
171 | * @see addValidator |
||
172 | * @return $this |
||
173 | */ |
||
174 | public function required() { |
||
178 | |||
179 | |||
180 | /** |
||
181 | * @param string $text |
||
182 | * @return $this |
||
183 | */ |
||
184 | 10 | public function setText($text) { |
|
188 | |||
189 | |||
190 | /** |
||
191 | * @return mixed |
||
192 | */ |
||
193 | public function getText() { |
||
196 | |||
197 | |||
198 | /** |
||
199 | * @param string $name |
||
200 | * @return $this |
||
201 | */ |
||
202 | 17 | public function setName($name) { |
|
206 | |||
207 | |||
208 | /** |
||
209 | * @return null|string |
||
210 | */ |
||
211 | 16 | public function getName() { |
|
214 | |||
215 | |||
216 | /** |
||
217 | * @param string $class |
||
218 | * @return $this |
||
219 | */ |
||
220 | 1 | public function setClass($class) { |
|
224 | |||
225 | |||
226 | /** |
||
227 | * @return null|string |
||
228 | */ |
||
229 | 1 | public function getClass() { |
|
232 | |||
233 | |||
234 | /** |
||
235 | * @param string $id |
||
236 | * @return $this |
||
237 | */ |
||
238 | public function setId($id) { |
||
242 | |||
243 | |||
244 | /** |
||
245 | * @return null|string |
||
246 | */ |
||
247 | public function getId() { |
||
250 | |||
251 | } |