<?php

namespace apexl\Io\modules\formbuilder\includes;

use apexl\Io\modules\formbuilder\includes\formField;

class toggleField extends formField
{
    public function __construct($name)
    {
        parent::__construct($name, 'input', 'toggleswitch');
        $this->offLabel();
        $this->onLabel();
    }

    public function offLabel($offLabel = 'Off')
    {
        $this->field->switchOff = $offLabel;
        return $this;
    }

    public function onLabel($onLabel = 'On')
    {
        $this->field->switchOn = $onLabel;
        return $this;
    }
}
