src/collections/Menu.php
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $options = ArrayHelper::getValue($item, 'options', []);

        $label = $this->getLabel($item);
        $url = ArrayHelper::getValue($item, 'url', '#');

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if ($this->activateItems && $active) {
            Html::addCssClass($options, 'active');
        }
        Html::addCssClass($options, 'item');

        $items = ArrayHelper::getValue($item, 'items');
        if ($items !== null) {
            return Dropdown::widget(
                [
                    'encodeText' => false,
                    'text' => $label,
                    'items' => $items,
                    'options' => $options
                ]
            );
        } else {
            return Html::a($label, $url, $options);
        }
    }
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $options = ArrayHelper::getValue($item, 'options', []);

        $label = $this->getLabel($item);
        $url = ArrayHelper::getValue($item, 'url', '#');

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if ($this->activateItems && $active) {
            Html::addCssClass($options, 'active');
        }
        Html::addCssClass($options, 'item');

        $items = ArrayHelper::getValue($item, 'items');
        if ($items !== null) {
            return Dropdown::widget(
                [
                    'encodeText' => false,
                    'text' => $label,
                    'items' => $items,
                    'options' => $options
                ]
            );
        } else {
            return Html::a($label, $url, $options);
        }
    }
Renders a widget's item.

@param string|array $item the item to render.

@return string the rendering result.
@throws InvalidConfigException