1 <?php
2
3 4 5 6 7
8
9 namespace nk2580\wordsmith\Inputs\Fields;
10
11 use nk2580\wordsmith\Inputs\Input as Input;
12
13 14 15 16 17
18 class CheckBoxField extends Input {
19
20 public function printField() {
21 $class = $this->getClassString();
22 if ($this->value == 1) {
23 echo '<label for="' . $this->name . '"><input checked="checked" type="checkbox" name="' . $this->name . '" class="' . $class . '" id="' . $this->name . '" value="1" >'.$this->label.'</label>';
24 } else {
25 echo '<label for="' . $this->name . '"><input type="checkbox" name="' . $this->name . '" class="' . $class . '" id="' . $this->name . '" value="1" >'.$this->label.'</label>';
26 }
27 echo '<br/>';
28 }
29
30 public function isFieldValid() {
31 return true;
32 }
33
34 public function sanitize() {
35 return ($this->value);
36 }
37
38 }
39