src/widget/Dropdown.php
protected function renderItems($items)
    {
        $lines = [];
        foreach ($items as $i => $item) {
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (is_string($item)) {
                $lines[] = $item;
                continue;
            }
            
            $options = ArrayHelper::getValue($item, 'options', []);            
            
            if(isset($item['divider'])){      
                Html::addCssClass($options, 'divider');
                $lines[] = Html::tag('li','', $options);
                continue;
            }
            
            if (!isset($item['label'])) {
                throw new InvalidConfigException("The 'label' option is required.");
            }
            $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];            
            $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
            $linkOptions['tabindex'] = '-1';
            $badgeOptions = ArrayHelper::getValue($item, 'badgeOptions', []);
            
            $label = Html::tag('i', '', $linkOptions).Html::tag('span', $label);
            $label .= $this->renderBadge($badgeOptions);
        
            $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'));
            if (!empty($item['items'])) {
                $content .= $this->renderItems($item['items']);
                Html::addCssClass($options, 'dropdown-submenu');
            }
            $lines[] = Html::tag('li', $content, $options);
        }

        return Html::tag('ul', implode("\n", $lines), $this->options);
    }
protected function renderItems($items)
    {
        $lines = [];
        foreach ($items as $i => $item) {
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (is_string($item)) {
                $lines[] = $item;
                continue;
            }
            
            $options = ArrayHelper::getValue($item, 'options', []);            
            
            if(isset($item['divider'])){      
                Html::addCssClass($options, 'divider');
                $lines[] = Html::tag('li','', $options);
                continue;
            }
            
            if (!isset($item['label'])) {
                throw new InvalidConfigException("The 'label' option is required.");
            }
            $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];            
            $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
            $linkOptions['tabindex'] = '-1';
            $badgeOptions = ArrayHelper::getValue($item, 'badgeOptions', []);
            
            $label = Html::tag('i', '', $linkOptions).Html::tag('span', $label);
            $label .= $this->renderBadge($badgeOptions);
        
            $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'));
            if (!empty($item['items'])) {
                $content .= $this->renderItems($item['items']);
                Html::addCssClass($options, 'dropdown-submenu');
            }
            $lines[] = Html::tag('li', $content, $options);
        }

        return Html::tag('ul', implode("\n", $lines), $this->options);
    }
Renders menu items.
@param array $items the menu items to be rendered
@return string the rendering result.
@throws InvalidConfigException if the label option is not specified in one of the items.