Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | public function generateElement() |
||
6 | { |
||
7 | if (!$this->getElement()->getValue()) { |
||
8 | $this->getElement()->setValue('on'); |
||
9 | } |
||
10 | $this->getElement()->removeClass('form-control'); |
||
11 | $this->getElement()->addClass('form-check-input'); |
||
12 | |||
13 | $class = get_class($this->getRenderer()) == Nip_Form_Renderer_Bootstrap::class ? 'checkbox' : 'form-check'; |
||
14 | $return = '<div class="' . $class . '">'; |
||
15 | $return .= '<label class="form-check-label">'; |
||
16 | $return .= parent::generateElement(); |
||
17 | $return .= ' ' . $this->getElement()->getLabel(); |
||
18 | $return .= '</label>'; |
||
19 | $return .= '</div>'; |
||
20 | |||
21 | return $return; |
||
22 | } |
||
32 |