protected function _renderOptgroup($label, $optgroup, $disabled, $selected, $templateVars, $escape)
    {
        $opts = $optgroup;
        $attrs = [];
        if (isset($optgroup['options'], $optgroup['text'])) {
            $opts = $optgroup['options'];
            $label = $optgroup['text'];
            $attrs = $optgroup;
        }
        $groupOptions = $this->_renderOptions($opts, $disabled, $selected, $templateVars, $escape);

        return $this->_templates->format('optgroup', [
            'label' => $escape ? h($label) : $label,
            'content' => implode('', $groupOptions),
            'templateVars' => $templateVars,
            'attrs' => $this->_templates->formatAttributes($attrs, ['text', 'options']),
        ]);
    }
protected function _renderOptgroup($label, $optgroup, $disabled, $selected, $templateVars, $escape)
    {
        $opts = $optgroup;
        $attrs = [];
        if (isset($optgroup['options'], $optgroup['text'])) {
            $opts = $optgroup['options'];
            $label = $optgroup['text'];
            $attrs = $optgroup;
        }
        $groupOptions = $this->_renderOptions($opts, $disabled, $selected, $templateVars, $escape);

        return $this->_templates->format('optgroup', [
            'label' => $escape ? h($label) : $label,
            'content' => implode('', $groupOptions),
            'templateVars' => $templateVars,
            'attrs' => $this->_templates->formatAttributes($attrs, ['text', 'options']),
        ]);
    }
protected function _renderOptgroup ( $ label , $ optgroup , $ disabled , $ selected , $ templateVars , $ escape ) { $ opts = $ optgroup ; $ attrs = [ ] ; if ( isset ( $ optgroup [ 'options' ] , $ optgroup [ 'text' ] ) ) { $ opts = $ optgroup [ 'options' ] ; $ label = $ optgroup [ 'text' ] ; $ attrs = $ optgroup ; } $ groupOptions = $ this -> _renderOptions ( $ opts , $ disabled , $ selected , $ templateVars , $ escape ) ; return $ this -> _templates -> format ( 'optgroup' , [ 'label' => $ escape ? h ( $ label ) : $ label , 'content' => implode ( '' , $ groupOptions ) , 'templateVars' => $ templateVars , 'attrs' => $ this -> _templates -> formatAttributes ( $ attrs , [ 'text' , 'options' ] ) , ] ) ; }
Render the contents of an optgroup element.

@param string $label The optgroup label text
@param array $optgroup The opt group data.
@param array|null $disabled The options to disable.
@param array|string|null $selected The options to select.
@param array $templateVars Additional template variables.
@param bool $escape Toggle HTML escaping
@return string Formatted template string
Render the contents of an optgroup element .