public function render(array $data, ContextInterface $context)
    {
        $data += [
            'value' => 1,
            'val' => null,
            'disabled' => false,
            'onLabel' => 'on',
            'offLabel' => 'off',
            'class' => ''
        ];

        if ($this->_isChecked($data)) {
            $data['checked'] = true;
        }
        unset($data['val']);

        $attrs = $this->_templates->formatAttributes(
            $data,
            ['name', 'value', 'onLabel', 'offLabel', 'type', 'class']
        );

        $checkbox = $this->_templates->format('checkbox', [
            'name' => $data['name'],
            'value' => $data['value'],
            'templateVars' => $data['templateVars'],
            'attrs' => $attrs
        ]);

        $toggleSwitch = $this->_templates->format('toggleSwitch', [
            'checkbox' => $checkbox,
            'onLabel' => $data['onLabel'],
            'offLabel' => $data['offLabel'],
            'attrs' => $this->_templates->formatAttributes(
                $data,
                ['name', 'type', 'value', 'class']
            )
        ]);

        $data['class'] = empty($data['class']) ? 'toggle-switch' : 'toggle-switch ' .$data['class'];
        return $this->_templates->format('nestingLabel', [
            'hidden' => '',
            'input' => $toggleSwitch,
            'attrs' => $this->_templates->formatAttributes(
                $data,
                ['name', 'type', 'value', 'onLabel', 'offLabel', 'id']
            )
        ]);
    }