widgets/Dropdown.php
protected function renderItems()
    {
        $lines = array();

        if ($this->type === Enum::DROPDOWN_CONTENT) {
            $lines[] = $this->dropdownContent;
        }
        if ($this->type === Enum::DROPDOWN_LIST) {
            foreach ($this->items as $item) {
                if (is_string($item)) {
                    $lines[] = $item;
                    continue;
                }
                if (!isset($item['label'])) {
                    throw new InvalidConfigException("The 'label' option is required.");
                }
                $label                   = $this->encodeLabels ? \CHtml::encode($item['label']) : $item['label'];
                $options                 = ArrayHelper::getValue($item, 'options', array());
                $linkOptions             = ArrayHelper::getValue($item, 'linkOptions', array());
                $linkOptions['tabindex'] = '-1';
                $content                 = \CHtml::link($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);

                $lines[] = \CHtml::tag('li', $options, $content);
            }
        }

        return \CHtml::tag('ul', $this->htmlOptions, implode("\n", $lines));
    }
protected function renderItems()
    {
        $lines = array();

        if ($this->type === Enum::DROPDOWN_CONTENT) {
            $lines[] = $this->dropdownContent;
        }
        if ($this->type === Enum::DROPDOWN_LIST) {
            foreach ($this->items as $item) {
                if (is_string($item)) {
                    $lines[] = $item;
                    continue;
                }
                if (!isset($item['label'])) {
                    throw new InvalidConfigException("The 'label' option is required.");
                }
                $label                   = $this->encodeLabels ? \CHtml::encode($item['label']) : $item['label'];
                $options                 = ArrayHelper::getValue($item, 'options', array());
                $linkOptions             = ArrayHelper::getValue($item, 'linkOptions', array());
                $linkOptions['tabindex'] = '-1';
                $content                 = \CHtml::link($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);

                $lines[] = \CHtml::tag('li', $options, $content);
            }
        }

        return \CHtml::tag('ul', $this->htmlOptions, implode("\n", $lines));
    }
protected function renderItems ( ) { $ lines = array ( ) ; if ( $ this -> type === Enum :: DROPDOWN_CONTENT ) { $ lines [ ] = $ this -> dropdownContent ; } if ( $ this -> type === Enum :: DROPDOWN_LIST ) { foreach ( $ this -> items as $ item ) { if ( is_string ( $ item ) ) { $ lines [ ] = $ item ; continue ; } if ( ! isset ( $ item [ 'label' ] ) ) { throw new InvalidConfigException ( "The 'label' option is required." ) ; } $ label = $ this -> encodeLabels ? \ CHtml :: encode ( $ item [ 'label' ] ) : $ item [ 'label' ] ; $ options = ArrayHelper :: getValue ( $ item , 'options' , array ( ) ) ; $ linkOptions = ArrayHelper :: getValue ( $ item , 'linkOptions' , array ( ) ) ; $ linkOptions [ 'tabindex' ] = '-1' ; $ content = \ CHtml :: link ( $ label , ArrayHelper :: getValue ( $ item , 'url' , '#' ) , $ linkOptions ) ; $ lines [ ] = \ CHtml :: tag ( 'li' , $ options , $ content ) ; } } return \ CHtml :: tag ( 'ul' , $ this -> htmlOptions , implode ( "\n" , $ lines ) ) ; }
Renders dropdown items
@return string
@throws InvalidConfigException
Renders dropdown items