public function renderOptgroup(array $optgroup, array $selectedOptions = array())
    {
        $template = '<optgroup%s>%s</optgroup>';

        $options = array();
        if (isset($optgroup['options']) && is_array($optgroup['options'])) {
            $options = $optgroup['options'];
            unset($optgroup['options']);
        }

        $this->validTagAttributes = $this->validOptgroupAttributes;
        $attributes = $this->createAttributesString($optgroup);
        if (!empty($attributes)) {
            $attributes = ' ' . $attributes;
        }

        return sprintf(
            $template,
            $attributes,
            $this->renderOptions($options, $selectedOptions)
        );
    }
public function renderOptgroup(array $optgroup, array $selectedOptions = array())
    {
        $template = '<optgroup%s>%s</optgroup>';

        $options = array();
        if (isset($optgroup['options']) && is_array($optgroup['options'])) {
            $options = $optgroup['options'];
            unset($optgroup['options']);
        }

        $this->validTagAttributes = $this->validOptgroupAttributes;
        $attributes = $this->createAttributesString($optgroup);
        if (!empty($attributes)) {
            $attributes = ' ' . $attributes;
        }

        return sprintf(
            $template,
            $attributes,
            $this->renderOptions($options, $selectedOptions)
        );
    }
public function renderOptgroup ( array $ optgroup , array $ selectedOptions = array ( ) ) { $ template = '<optgroup%s>%s</optgroup>' ; $ options = array ( ) ; if ( isset ( $ optgroup [ 'options' ] ) && is_array ( $ optgroup [ 'options' ] ) ) { $ options = $ optgroup [ 'options' ] ; unset ( $ optgroup [ 'options' ] ) ; } $ this -> validTagAttributes = $ this -> validOptgroupAttributes ; $ attributes = $ this -> createAttributesString ( $ optgroup ) ; if ( ! empty ( $ attributes ) ) { $ attributes = ' ' . $ attributes ; } return sprintf ( $ template , $ attributes , $ this -> renderOptions ( $ options , $ selectedOptions ) ) ; }
Render an optgroup

See {@link renderOptions()} for the options specification. Basically,
an optgroup is simply an option that has an additional "options" key
with an array following the specification for renderOptions().

@param  array $optgroup
@param  array $selectedOptions
@return string
Render an optgroup