src/Helpers/FormRenderer.php
protected function checkbox(array $field)
    {
        $output = '';

        // Div tag.
        $attributes = $field['attributes'];
//?        unset($attributes['required']);

        $output .= $this->getWrapper('input', $attributes);
        $output .= $this->getWrapper('checkbox', $attributes);

        // Checkboxes.
        foreach ($field['options'] as $value => $text) {
            $checkboxAttributes = $this->getCheckboxAttributes($field['id'], $field['name'], $value);
            if (in_array($value, $field['value'], false)) {
                $checkboxAttributes['checked'] = true;
            }
            $output .= $this->getWrapper('checkbox1');
            $checkboxInput = $this->getOpenTag('input', $checkboxAttributes);
            if ($this->checkboxInputInLabel) {
                $output .= $this->renderLabel($text, $checkboxAttributes['id'], array(), false, $checkboxInput);
            } else {
                $output .= $checkboxInput;
                $output .= $this->renderLabel($text, $checkboxAttributes['id'], array(), false);
            }
            $output .= $this->getWrapperEnd('checkbox1');
        }

        // End tag.
        $output .= $this->getWrapperEnd('checkbox');
        $output .= $this->getWrapperEnd('input');

        return $output;
    }
protected function checkbox(array $field)
    {
        $output = '';

        // Div tag.
        $attributes = $field['attributes'];
//?        unset($attributes['required']);

        $output .= $this->getWrapper('input', $attributes);
        $output .= $this->getWrapper('checkbox', $attributes);

        // Checkboxes.
        foreach ($field['options'] as $value => $text) {
            $checkboxAttributes = $this->getCheckboxAttributes($field['id'], $field['name'], $value);
            if (in_array($value, $field['value'], false)) {
                $checkboxAttributes['checked'] = true;
            }
            $output .= $this->getWrapper('checkbox1');
            $checkboxInput = $this->getOpenTag('input', $checkboxAttributes);
            if ($this->checkboxInputInLabel) {
                $output .= $this->renderLabel($text, $checkboxAttributes['id'], array(), false, $checkboxInput);
            } else {
                $output .= $checkboxInput;
                $output .= $this->renderLabel($text, $checkboxAttributes['id'], array(), false);
            }
            $output .= $this->getWrapperEnd('checkbox1');
        }

        // End tag.
        $output .= $this->getWrapperEnd('checkbox');
        $output .= $this->getWrapperEnd('input');

        return $output;
    }
protected function checkbox ( array $ field ) { $ output = '' ; // Div tag. $ attributes = $ field [ 'attributes' ] ; //?        unset($attributes['required']); $ output .= $ this -> getWrapper ( 'input' , $ attributes ) ; $ output .= $ this -> getWrapper ( 'checkbox' , $ attributes ) ; // Checkboxes. foreach ( $ field [ 'options' ] as $ value => $ text ) { $ checkboxAttributes = $ this -> getCheckboxAttributes ( $ field [ 'id' ] , $ field [ 'name' ] , $ value ) ; if ( in_array ( $ value , $ field [ 'value' ] , false ) ) { $ checkboxAttributes [ 'checked' ] = true ; } $ output .= $ this -> getWrapper ( 'checkbox1' ) ; $ checkboxInput = $ this -> getOpenTag ( 'input' , $ checkboxAttributes ) ; if ( $ this -> checkboxInputInLabel ) { $ output .= $ this -> renderLabel ( $ text , $ checkboxAttributes [ 'id' ] , array ( ) , false , $ checkboxInput ) ; } else { $ output .= $ checkboxInput ; $ output .= $ this -> renderLabel ( $ text , $ checkboxAttributes [ 'id' ] , array ( ) , false ) ; } $ output .= $ this -> getWrapperEnd ( 'checkbox1' ) ; } // End tag. $ output .= $ this -> getWrapperEnd ( 'checkbox' ) ; $ output .= $ this -> getWrapperEnd ( 'input' ) ; return $ output ; }
Renders a list of checkboxes.

@param array $field

@return string
The rendered checkboxes.
Renders a list of checkboxes .