code/template/helper/select.php
public function radiolist($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'options' 	=> array(),
            'legend'    => null,
            'name'   	=> 'id',
            'selected'	=> null,
            'translate'	=> false,
            'attribs'	=> array(),
        ));

        $translator = $this->getObject('translator');
        $attribs    = $this->buildAttributes($config->attribs);

        $html   = array();
        $html[] = '<fieldset  name="'. $config->name .'" '. $attribs .'>';

        if(isset($config->legend)) {
            $html[] = '<legend>'.$config->translate ? $translator->translate( $config->legend ) : $config->legend.'</legend>';
        }

        foreach($config->options as $option)
        {
            $value = $option->value;
            $label = $config->translate ? $translator->translate( $option->label ) : $option->label;

            $extra = ($value == $config->selected ? 'checked="checked"' : '');

            if(isset($option->disabled) && $option->disabled) {
                $extra .= 'disabled="disabled"';
            }

            if(isset($option->attribs)) {
                $attribs = $this->buildAttributes($option->attribs);
            }

            $html[] = '<label class="radio" for="'.$config->name.$option->id.'">';
            $html[] = '<input type="radio" name="'.$config->name.'" id="'.$config->name.$option->id.'" value="'.$value.'" '.$extra.' '.$attribs.' />';
            $html[] = $label;
            $html[] = '</label>';
        }

        $html[] = '</fieldset>';

        return implode(PHP_EOL, $html);
    }
public function radiolist($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'options' 	=> array(),
            'legend'    => null,
            'name'   	=> 'id',
            'selected'	=> null,
            'translate'	=> false,
            'attribs'	=> array(),
        ));

        $translator = $this->getObject('translator');
        $attribs    = $this->buildAttributes($config->attribs);

        $html   = array();
        $html[] = '<fieldset  name="'. $config->name .'" '. $attribs .'>';

        if(isset($config->legend)) {
            $html[] = '<legend>'.$config->translate ? $translator->translate( $config->legend ) : $config->legend.'</legend>';
        }

        foreach($config->options as $option)
        {
            $value = $option->value;
            $label = $config->translate ? $translator->translate( $option->label ) : $option->label;

            $extra = ($value == $config->selected ? 'checked="checked"' : '');

            if(isset($option->disabled) && $option->disabled) {
                $extra .= 'disabled="disabled"';
            }

            if(isset($option->attribs)) {
                $attribs = $this->buildAttributes($option->attribs);
            }

            $html[] = '<label class="radio" for="'.$config->name.$option->id.'">';
            $html[] = '<input type="radio" name="'.$config->name.'" id="'.$config->name.$option->id.'" value="'.$value.'" '.$extra.' '.$attribs.' />';
            $html[] = $label;
            $html[] = '</label>';
        }

        $html[] = '</fieldset>';

        return implode(PHP_EOL, $html);
    }
public function radiolist ( $ config = array ( ) ) { $ config = new ObjectConfigJson ( $ config ) ; $ config -> append ( array ( 'options' => array ( ) , 'legend' => null , 'name' => 'id' , 'selected' => null , 'translate' => false , 'attribs' => array ( ) , ) ) ; $ translator = $ this -> getObject ( 'translator' ) ; $ attribs = $ this -> buildAttributes ( $ config -> attribs ) ; $ html = array ( ) ; $ html [ ] = '<fieldset  name="' . $ config -> name . '" ' . $ attribs . '>' ; if ( isset ( $ config -> legend ) ) { $ html [ ] = '<legend>' . $ config -> translate ? $ translator -> translate ( $ config -> legend ) : $ config -> legend . '</legend>' ; } foreach ( $ config -> options as $ option ) { $ value = $ option -> value ; $ label = $ config -> translate ? $ translator -> translate ( $ option -> label ) : $ option -> label ; $ extra = ( $ value == $ config -> selected ? 'checked="checked"' : '' ) ; if ( isset ( $ option -> disabled ) && $ option -> disabled ) { $ extra .= 'disabled="disabled"' ; } if ( isset ( $ option -> attribs ) ) { $ attribs = $ this -> buildAttributes ( $ option -> attribs ) ; } $ html [ ] = '<label class="radio" for="' . $ config -> name . $ option -> id . '">' ; $ html [ ] = '<input type="radio" name="' . $ config -> name . '" id="' . $ config -> name . $ option -> id . '" value="' . $ value . '" ' . $ extra . ' ' . $ attribs . ' />' ; $ html [ ] = $ label ; $ html [ ] = '</label>' ; } $ html [ ] = '</fieldset>' ; return implode ( PHP_EOL , $ html ) ; }
Generates an HTML radio list

@param   array|ObjectConfig     $config An optional array with configuration options
@return  string  Html
Generates an HTML radio list