src/Helpers/Form.php
public function generateCheckboxField($attr)
    {
        if (empty($attr['name'])) {
            return '';
        }

        $out = '';

        if ((isset($attr['hiddenCheckbox']) && $attr['hiddenCheckbox']) || ! isset($attr['hiddenCheckbox'])) {
            $out .= $this->input(
                $attr['name'],
                false,
                array(
                    'type' => 'hidden',
                    'wrapper' => false,
                    'id' => '_' . $attr['id'],
                    'value' => 0
                )
            );
        }
        unset($attr['hiddenCheckbox']);

        if (! isset($attr['value'])) {
            $attr['value'] = 1;
        }

        $out .= $this->Html->tag('input', $attr);
        return $out;
    }
public function generateCheckboxField($attr)
    {
        if (empty($attr['name'])) {
            return '';
        }

        $out = '';

        if ((isset($attr['hiddenCheckbox']) && $attr['hiddenCheckbox']) || ! isset($attr['hiddenCheckbox'])) {
            $out .= $this->input(
                $attr['name'],
                false,
                array(
                    'type' => 'hidden',
                    'wrapper' => false,
                    'id' => '_' . $attr['id'],
                    'value' => 0
                )
            );
        }
        unset($attr['hiddenCheckbox']);

        if (! isset($attr['value'])) {
            $attr['value'] = 1;
        }

        $out .= $this->Html->tag('input', $attr);
        return $out;
    }
public function generateCheckboxField ( $ attr ) { if ( empty ( $ attr [ 'name' ] ) ) { return '' ; } $ out = '' ; if ( ( isset ( $ attr [ 'hiddenCheckbox' ] ) && $ attr [ 'hiddenCheckbox' ] ) || ! isset ( $ attr [ 'hiddenCheckbox' ] ) ) { $ out .= $ this -> input ( $ attr [ 'name' ] , false , array ( 'type' => 'hidden' , 'wrapper' => false , 'id' => '_' . $ attr [ 'id' ] , 'value' => 0 ) ) ; } unset ( $ attr [ 'hiddenCheckbox' ] ) ; if ( ! isset ( $ attr [ 'value' ] ) ) { $ attr [ 'value' ] = 1 ; } $ out .= $ this -> Html -> tag ( 'input' , $ attr ) ; return $ out ; }
generate a checkbox

@param   array   array of attributes
@return  string
generate a checkbox