/** * Override to allow for not including the uncheck hidden element when not wanted * e.g. when the checkbox is disabled * * {@inheritDoc} * @see \yii\widgets\ActiveField::checkbox($options, $enclosedByLabel) */ public function checkbox($options = [], $enclosedByLabel = true) { if ($enclosedByLabel) { $this->parts['{input}'] = Html::activeCheckbox($this->model, $this->attribute, $options); $this->parts['{label}'] = ''; } else { if (isset($options['label']) && !isset($this->parts['{label}'])) { $this->parts['{label}'] = $options['label']; if (!empty($options['labelOptions'])) { $this->labelOptions = $options['labelOptions']; } } unset($options['labelOptions']); $options['label'] = null; $this->parts['{input}'] = Html::activeCheckbox($this->model, $this->attribute, $options); } $this->adjustLabelFor($options); return $this; }