protected function renderSwitch()
    {
        $value = ArrayHelper::getValue($this->inputOptions, 'value', null);

        if ($this->hasModel()) {
            $attributeValue = Html::getAttributeValue($this->model, $this->attribute);
            $this->checked = "{$value}" === "{$attributeValue}";
        }

        $name = ArrayHelper::remove($this->inputOptions, 'name', null);

        return implode("\n", [
            Html::beginTag('label'),
            $this->renderLabel('off'),
            Html::checkbox($name, $this->checked, $this->inputOptions),
            Html::tag('span', '', ['class' => 'lever']),
            $this->renderLabel('on'),
            Html::endTag('label'),
        ]);
    }