protected function _renderInput($checkbox, $context)
    {
        $input = $this->_templates->format('checkbox', [
            'name' => $checkbox['name'] . '[]',
            'value' => $checkbox['escape'] ? h($checkbox['value']) : $checkbox['value'],
            'templateVars' => $checkbox['templateVars'],
            'attrs' => $this->_templates->formatAttributes(
                $checkbox,
                ['name', 'value', 'text', 'options', 'label', 'val', 'type']
            )
        ]);

        if ($checkbox['label'] === false && strpos($this->_templates->get('checkboxWrapper'), '{{input}}') === false) {
            $label = $input;
        } else {
            $labelAttrs = is_array($checkbox['label']) ? $checkbox['label'] : [];
            $labelAttrs += [
                'for' => $checkbox['id'],
                'escape' => $checkbox['escape'],
                'text' => $checkbox['text'],
                'templateVars' => $checkbox['templateVars'],
                'input' => $input
            ];

            if ($checkbox['checked']) {
                $labelAttrs = $this->_templates->addClass($labelAttrs, 'selected');
            }

            $label = $this->_label->render($labelAttrs, $context);
        }

        return $this->_templates->format('checkboxWrapper', [
            'templateVars' => $checkbox['templateVars'],
            'label' => $label,
            'input' => $input
        ]);
    }
protected function _renderInput($checkbox, $context)
    {
        $input = $this->_templates->format('checkbox', [
            'name' => $checkbox['name'] . '[]',
            'value' => $checkbox['escape'] ? h($checkbox['value']) : $checkbox['value'],
            'templateVars' => $checkbox['templateVars'],
            'attrs' => $this->_templates->formatAttributes(
                $checkbox,
                ['name', 'value', 'text', 'options', 'label', 'val', 'type']
            )
        ]);

        if ($checkbox['label'] === false && strpos($this->_templates->get('checkboxWrapper'), '{{input}}') === false) {
            $label = $input;
        } else {
            $labelAttrs = is_array($checkbox['label']) ? $checkbox['label'] : [];
            $labelAttrs += [
                'for' => $checkbox['id'],
                'escape' => $checkbox['escape'],
                'text' => $checkbox['text'],
                'templateVars' => $checkbox['templateVars'],
                'input' => $input
            ];

            if ($checkbox['checked']) {
                $labelAttrs = $this->_templates->addClass($labelAttrs, 'selected');
            }

            $label = $this->_label->render($labelAttrs, $context);
        }

        return $this->_templates->format('checkboxWrapper', [
            'templateVars' => $checkbox['templateVars'],
            'label' => $label,
            'input' => $input
        ]);
    }
protected function _renderInput ( $ checkbox , $ context ) { $ input = $ this -> _templates -> format ( 'checkbox' , [ 'name' => $ checkbox [ 'name' ] . '[]' , 'value' => $ checkbox [ 'escape' ] ? h ( $ checkbox [ 'value' ] ) : $ checkbox [ 'value' ] , 'templateVars' => $ checkbox [ 'templateVars' ] , 'attrs' => $ this -> _templates -> formatAttributes ( $ checkbox , [ 'name' , 'value' , 'text' , 'options' , 'label' , 'val' , 'type' ] ) ] ) ; if ( $ checkbox [ 'label' ] === false && strpos ( $ this -> _templates -> get ( 'checkboxWrapper' ) , '{{input}}' ) === false ) { $ label = $ input ; } else { $ labelAttrs = is_array ( $ checkbox [ 'label' ] ) ? $ checkbox [ 'label' ] : [ ] ; $ labelAttrs += [ 'for' => $ checkbox [ 'id' ] , 'escape' => $ checkbox [ 'escape' ] , 'text' => $ checkbox [ 'text' ] , 'templateVars' => $ checkbox [ 'templateVars' ] , 'input' => $ input ] ; if ( $ checkbox [ 'checked' ] ) { $ labelAttrs = $ this -> _templates -> addClass ( $ labelAttrs , 'selected' ) ; } $ label = $ this -> _label -> render ( $ labelAttrs , $ context ) ; } return $ this -> _templates -> format ( 'checkboxWrapper' , [ 'templateVars' => $ checkbox [ 'templateVars' ] , 'label' => $ label , 'input' => $ input ] ) ; }
Render a single checkbox & wrapper.

@param array $checkbox An array containing checkbox key/value option pairs
@param \Cake\View\Form\ContextInterface $context Context object.
@return string
Render a single checkbox & wrapper .