protected function generateOption($val, $index)
    {
        $checked = '';
        if (is_array($this->varValue) && in_array($val['value'], $this->varValue)) {
            $checked = ' checked="checked"';
        }

        return sprintf(
            '<span class="%1$s opt_%2$s">' .
            '<input type="checkbox" name="%8$s[]" id="opt_%3$s" class="checkbox" value="%4$s"%5$s%6$s ' .
            '<label id="lbl_%3$s" for="opt_%3$s">%7$s</label></span>',
            // @codingStandardsIgnoreStart - Keep the comments.
            $this->getClassForOption($index),             // 1
            $index,                                       // 2
            $this->strName.'_'.$index,                    // 3
            $val['value'],                                // 4
            $checked,                                     // 5
            $this->getAttributes() . $this->strTagEnding, // 6
            $val['label'],                                // 7
            $this->strName                                // 8
            // @codingStandardsIgnoreEnd
        );
    }
protected function generateOption($val, $index)
    {
        $checked = '';
        if (is_array($this->varValue) && in_array($val['value'], $this->varValue)) {
            $checked = ' checked="checked"';
        }

        return sprintf(
            '<span class="%1$s opt_%2$s">' .
            '<input type="checkbox" name="%8$s[]" id="opt_%3$s" class="checkbox" value="%4$s"%5$s%6$s ' .
            '<label id="lbl_%3$s" for="opt_%3$s">%7$s</label></span>',
            // @codingStandardsIgnoreStart - Keep the comments.
            $this->getClassForOption($index),             // 1
            $index,                                       // 2
            $this->strName.'_'.$index,                    // 3
            $val['value'],                                // 4
            $checked,                                     // 5
            $this->getAttributes() . $this->strTagEnding, // 6
            $val['label'],                                // 7
            $this->strName                                // 8
            // @codingStandardsIgnoreEnd
        );
    }
protected function generateOption ( $ val , $ index ) { $ checked = '' ; if ( is_array ( $ this -> varValue ) && in_array ( $ val [ 'value' ] , $ this -> varValue ) ) { $ checked = ' checked="checked"' ; } return sprintf ( '<span class="%1$s opt_%2$s">' . '<input type="checkbox" name="%8$s[]" id="opt_%3$s" class="checkbox" value="%4$s"%5$s%6$s ' . '<label id="lbl_%3$s" for="opt_%3$s">%7$s</label></span>' , // @codingStandardsIgnoreStart - Keep the comments. $ this -> getClassForOption ( $ index ) , // 1 $ index , // 2 $ this -> strName . '_' . $ index , // 3 $ val [ 'value' ] , // 4 $ checked , // 5 $ this -> getAttributes ( ) . $ this -> strTagEnding , // 6 $ val [ 'label' ] , // 7 $ this -> strName // 8 // @codingStandardsIgnoreEnd ) ; }
Generate a single checkbox.

@param array $val   The value array (needs keys "value" and "label").

@param int   $index The sequence number of this option (used for even/odd determination).

@return string
Generate a single checkbox .