src/widget/Nav.php
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if(isset($item['content'])){
            return Html::tag('li', $item['content'], $item['options']);
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];
        $options = ArrayHelper::getValue($item, 'options', []);
        $items = ArrayHelper::getValue($item, 'items');
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
        $badgeOptions = ArrayHelper::getValue($item, 'badgeOptions', []);

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

        if ($items !== null) {
            //$linkOptions['data-toggle'] = 'treeview';
            Html::addCssClass($options, 'treeview');
            //Html::addCssClass($linkOptions, 'treeview-menu');
            //$label .= ' ' . Html::tag('i', '', ['class' => 'fa fa-angle-left pull-right']);
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = Dropdown::widget([
                    'items' => $items,
                    'encodeLabels' => $this->encodeLabels,
                    'clientOptions' => false,
                    'type' => Dropdown::NAV, 
                    'view' => $this->getView(),
                ]);
            }
        }

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

        $label = Html::tag('i', '', $linkOptions).Html::tag('span', $label);
        $label .= $this->renderBadge($badgeOptions);
        if ($items !== null) {
            $label .= Html::tag('i', '', ['class' => 'fa fa-angle-left pull-right']);
        }

        return Html::tag('li', Html::a($label, $url) . $items, $options);
    }
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if(isset($item['content'])){
            return Html::tag('li', $item['content'], $item['options']);
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];
        $options = ArrayHelper::getValue($item, 'options', []);
        $items = ArrayHelper::getValue($item, 'items');
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
        $badgeOptions = ArrayHelper::getValue($item, 'badgeOptions', []);

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

        if ($items !== null) {
            //$linkOptions['data-toggle'] = 'treeview';
            Html::addCssClass($options, 'treeview');
            //Html::addCssClass($linkOptions, 'treeview-menu');
            //$label .= ' ' . Html::tag('i', '', ['class' => 'fa fa-angle-left pull-right']);
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = Dropdown::widget([
                    'items' => $items,
                    'encodeLabels' => $this->encodeLabels,
                    'clientOptions' => false,
                    'type' => Dropdown::NAV, 
                    'view' => $this->getView(),
                ]);
            }
        }

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

        $label = Html::tag('i', '', $linkOptions).Html::tag('span', $label);
        $label .= $this->renderBadge($badgeOptions);
        if ($items !== null) {
            $label .= Html::tag('i', '', ['class' => 'fa fa-angle-left pull-right']);
        }

        return Html::tag('li', Html::a($label, $url) . $items, $options);
    }
public function renderItem ( $ item ) { if ( is_string ( $ item ) ) { return $ item ; } if ( isset ( $ item [ 'content' ] ) ) { return Html :: tag ( 'li' , $ item [ 'content' ] , $ item [ 'options' ] ) ; } if ( ! isset ( $ item [ 'label' ] ) ) { throw new InvalidConfigException ( "The 'label' option is required." ) ; } $ label = $ this -> encodeLabels ? Html :: encode ( $ item [ 'label' ] ) : $ item [ 'label' ] ; $ options = ArrayHelper :: getValue ( $ item , 'options' , [ ] ) ; $ items = ArrayHelper :: getValue ( $ item , 'items' ) ; $ url = ArrayHelper :: getValue ( $ item , 'url' , '#' ) ; $ linkOptions = ArrayHelper :: getValue ( $ item , 'linkOptions' , [ ] ) ; $ badgeOptions = ArrayHelper :: getValue ( $ item , 'badgeOptions' , [ ] ) ; if ( isset ( $ item [ 'active' ] ) ) { $ active = ArrayHelper :: remove ( $ item , 'active' , false ) ; } else { $ active = $ this -> isItemActive ( $ item ) ; } if ( $ items !== null ) { //$linkOptions['data-toggle'] = 'treeview'; Html :: addCssClass ( $ options , 'treeview' ) ; //Html::addCssClass($linkOptions, 'treeview-menu'); //$label .= ' ' . Html::tag('i', '', ['class' => 'fa fa-angle-left pull-right']); if ( is_array ( $ items ) ) { if ( $ this -> activateItems ) { $ items = $ this -> isChildActive ( $ items , $ active ) ; } $ items = Dropdown :: widget ( [ 'items' => $ items , 'encodeLabels' => $ this -> encodeLabels , 'clientOptions' => false , 'type' => Dropdown :: NAV , 'view' => $ this -> getView ( ) , ] ) ; } } if ( $ this -> activateItems && $ active ) { Html :: addCssClass ( $ options , 'active' ) ; } $ label = Html :: tag ( 'i' , '' , $ linkOptions ) . Html :: tag ( 'span' , $ label ) ; $ label .= $ this -> renderBadge ( $ badgeOptions ) ; if ( $ items !== null ) { $ label .= Html :: tag ( 'i' , '' , [ 'class' => 'fa fa-angle-left pull-right' ] ) ; } return Html :: tag ( 'li' , Html :: a ( $ label , $ url ) . $ items , $ options ) ; }
Renders a widget's item.
@param string|array $item the item to render.
@return string the rendering result.
@throws InvalidConfigException
Renders a widget s item .