concrete/src/Form/Service/Form.php
public function radio($key, $value, $checkedValueOrMiscFields = '', $miscFields = [])
    {
        if (is_array($checkedValueOrMiscFields)) {
            $checkedValue = '';
            $miscFields = $checkedValueOrMiscFields;
        } else {
            $checkedValue = $checkedValueOrMiscFields;
        }
        $checked = false;

        $requestValue = $this->getRequestValue($key);

        if ($requestValue !== false) {
            if ($requestValue == $value) {
                $checked = true;
            }
        } else {
            if ($checkedValue == $value) {
                $checked = true;
            }
        }
        $id = null;
        if (isset($miscFields['id'])) {
            $id = $miscFields['id'];
            unset($miscFields['id']);
        }
        $id = $id ?: $key . $this->radioIndex;
        $str = '<input type="radio" id="' . $id . '" name="' . $key . '" value="' . $value . '"';
        $str .= $this->parseMiscFields('ccm-input-radio', $miscFields);
        if ($checked) {
            $str .= ' checked="checked"';
        }
        $str .= ' />';
        ++$this->radioIndex;

        return $str;
    }
public function radio($key, $value, $checkedValueOrMiscFields = '', $miscFields = [])
    {
        if (is_array($checkedValueOrMiscFields)) {
            $checkedValue = '';
            $miscFields = $checkedValueOrMiscFields;
        } else {
            $checkedValue = $checkedValueOrMiscFields;
        }
        $checked = false;

        $requestValue = $this->getRequestValue($key);

        if ($requestValue !== false) {
            if ($requestValue == $value) {
                $checked = true;
            }
        } else {
            if ($checkedValue == $value) {
                $checked = true;
            }
        }
        $id = null;
        if (isset($miscFields['id'])) {
            $id = $miscFields['id'];
            unset($miscFields['id']);
        }
        $id = $id ?: $key . $this->radioIndex;
        $str = '<input type="radio" id="' . $id . '" name="' . $key . '" value="' . $value . '"';
        $str .= $this->parseMiscFields('ccm-input-radio', $miscFields);
        if ($checked) {
            $str .= ' checked="checked"';
        }
        $str .= ' />';
        ++$this->radioIndex;

        return $str;
    }
public function radio ( $ key , $ value , $ checkedValueOrMiscFields = '' , $ miscFields = [ ] ) { if ( is_array ( $ checkedValueOrMiscFields ) ) { $ checkedValue = '' ; $ miscFields = $ checkedValueOrMiscFields ; } else { $ checkedValue = $ checkedValueOrMiscFields ; } $ checked = false ; $ requestValue = $ this -> getRequestValue ( $ key ) ; if ( $ requestValue !== false ) { if ( $ requestValue == $ value ) { $ checked = true ; } } else { if ( $ checkedValue == $ value ) { $ checked = true ; } } $ id = null ; if ( isset ( $ miscFields [ 'id' ] ) ) { $ id = $ miscFields [ 'id' ] ; unset ( $ miscFields [ 'id' ] ) ; } $ id = $ id ? : $ key . $ this -> radioIndex ; $ str = '<input type="radio" id="' . $ id . '" name="' . $ key . '" value="' . $ value . '"' ; $ str .= $ this -> parseMiscFields ( 'ccm-input-radio' , $ miscFields ) ; if ( $ checked ) { $ str .= ' checked="checked"' ; } $ str .= ' />' ; ++ $ this -> radioIndex ; return $ str ; }
Generates a radio button.

@param string $key the name of the element (its id will start with $key but will have a progressive unique number added)
@param string $value the value of the radio button
@param string|array $checkedValueOrMiscFields the value of the element (if it should be initially checked) or an array with additional fields appended to the element (a hash array of attributes name => value), possibly including 'class'
@param array $miscFields (used if $checkedValueOrMiscFields is not an array) Additional fields appended to the element (a hash array of attributes name => value), possibly including 'class'

@return string
Generates a radio button .