| 1 |
<?php |
| 2 |
|
| 3 |
namespace ResponsiveMenu\Form; |
| 4 |
use ResponsiveMenu\Models\Option as Option; |
| 5 |
use ResponsiveMenu\Form\FormComponent as FormComponent; |
| 6 |
|
| 7 |
class Checkbox implements FormComponent |
| 8 |
{ |
| 9 |
|
| 10 |
public function render(Option $option) |
| 11 |
{ |
| 12 |
$checked = $option->getValue() == 'on' ? 'checked="checked"' : ''; |
| 13 |
|
| 14 |
echo "<div class='onoffswitch'> |
| 15 |
<input type='checkbox' |
| 16 |
class='checkbox onoffswitch-checkbox' |
| 17 |
id='{$option->getName()}' |
| 18 |
$checked |
| 19 |
name='menu[{$option->getName()}]' |
| 20 |
value='on' /> |
| 21 |
<label class='onoffswitch-label' for='{$option->getName()}'> |
| 22 |
<span class='onoffswitch-inner'></span> |
| 23 |
<span class='onoffswitch-switch'></span> |
| 24 |
</label> |
| 25 |
</div>"; |
| 26 |
} |
| 27 |
|
| 28 |
} |
| 29 |
|