public function checkbox($fieldName, array $options = [])
{
$options += ['hiddenField' => true, 'value' => 1];
// Work around value=>val translations.
$value = $options['value'];
unset($options['value']);
$options = $this->_initInputField($fieldName, $options);
$options['value'] = $value;
$output = '';
if ($options['hiddenField']) {
$hiddenOptions = ['name' => $options['name'], 'value' => $options['hiddenField'] !== true && $options['hiddenField'] !== '_split' ? $options['hiddenField'] : '0', 'form' => isset($options['form']) ? $options['form'] : null, 'secure' => false];
if (isset($options['disabled']) && $options['disabled']) {
$hiddenOptions['disabled'] = 'disabled';
}
$output = $this->hidden($fieldName, $hiddenOptions);
}
if ($options['hiddenField'] === '_split') {
unset($options['hiddenField'], $options['type']);
return ['hidden' => $output, 'input' => $this->widget('checkbox', $options)];
}
unset($options['hiddenField'], $options['type']);
return $output . $this->widget('checkbox', $options);
}