| Conditions | 4 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 30 | public function make() |
||
| 31 | { |
||
| 32 | // hook DOM model: build "hidden" field with value="0" for this box |
||
| 33 | $response = self::buildSingleTag('input', [ |
||
| 34 | 'type' => 'hidden', |
||
| 35 | 'value' => '0', |
||
| 36 | 'name' => $this->properties['name'] |
||
| 37 | ]); |
||
| 38 | |||
| 39 | // set field type |
||
| 40 | $this->properties['type'] = 'checkbox'; |
||
| 41 | if ($this->value === 1 || $this->value === true || $this->value === '1') { |
||
| 42 | $this->properties['checked'] = null; // set checked if active |
||
| 43 | } |
||
| 44 | |||
| 45 | unset($this->properties['required']); |
||
| 46 | // this item always have "1" value (0 is hidden and active when this is :not(checked) |
||
| 47 | $this->properties['value'] = '1'; |
||
| 48 | $response .= self::buildSingleTag('input', $this->properties); |
||
| 49 | return $response; |
||
| 50 | } |
||
| 51 | } |