protected function processMenu($menu, $horizontal)
    {
        $result = [];
        foreach ($menu as $section => $items) {
            if (!$horizontal) {
                switch ($section) {
                    default:
                    case self::SECT_COMMON:
                        $result[$section] = ['label' => Yii::t('app', 'Common')];
                        break;
                    case self::SECT_CURRENT:
                        $result[] = ['label' => Yii::t('app', 'Current')];
                        break;
                }
            }
            foreach ($items as $key => $item) {
                $isActive = isset($item['active']) && $item['active'];
                $isDisabled = isset($item['disabled']) && $item['disabled'];
                if ($isActive || $isDisabled) {
                    if ($isDisabled) {
                        $item['url'] = '#';
                        \yii\helpers\Html::addCssClass($item['options'], 'disabled');
                    }
                    if (isset($item['linkOptions']) && isset($item['linkOptions']['data-confirm'])) {
                        unset($item['linkOptions']['data-confirm']);
                    }
                    if (isset($item['linkOptions']) && isset($item['linkOptions']['data-method'])) {
                        unset($item['linkOptions']['data-method']);
                    }
                }
                $encode = isset($item['encode']) ? $item['encode'] : true;
                $label = $encode ? \yii\helpers\Html::encode($item['label']) : $item['label'];
                if (isset($item['icon'])) {
                    $item['label'] = '<i class="glyphicon glyphicon-'.$item['icon'].'"></i> '. $label;
                    $item['encode'] = false;
                    unset($item['icon']);
                }
                $result[$section . '-' . $key] = $item;
            }
        }
        return $result;
    }
protected function processMenu($menu, $horizontal)
    {
        $result = [];
        foreach ($menu as $section => $items) {
            if (!$horizontal) {
                switch ($section) {
                    default:
                    case self::SECT_COMMON:
                        $result[$section] = ['label' => Yii::t('app', 'Common')];
                        break;
                    case self::SECT_CURRENT:
                        $result[] = ['label' => Yii::t('app', 'Current')];
                        break;
                }
            }
            foreach ($items as $key => $item) {
                $isActive = isset($item['active']) && $item['active'];
                $isDisabled = isset($item['disabled']) && $item['disabled'];
                if ($isActive || $isDisabled) {
                    if ($isDisabled) {
                        $item['url'] = '#';
                        \yii\helpers\Html::addCssClass($item['options'], 'disabled');
                    }
                    if (isset($item['linkOptions']) && isset($item['linkOptions']['data-confirm'])) {
                        unset($item['linkOptions']['data-confirm']);
                    }
                    if (isset($item['linkOptions']) && isset($item['linkOptions']['data-method'])) {
                        unset($item['linkOptions']['data-method']);
                    }
                }
                $encode = isset($item['encode']) ? $item['encode'] : true;
                $label = $encode ? \yii\helpers\Html::encode($item['label']) : $item['label'];
                if (isset($item['icon'])) {
                    $item['label'] = '<i class="glyphicon glyphicon-'.$item['icon'].'"></i> '. $label;
                    $item['encode'] = false;
                    unset($item['icon']);
                }
                $result[$section . '-' . $key] = $item;
            }
        }
        return $result;
    }
protected function processMenu ( $ menu , $ horizontal ) { $ result = [ ] ; foreach ( $ menu as $ section => $ items ) { if ( ! $ horizontal ) { switch ( $ section ) { default : case self :: SECT_COMMON : $ result [ $ section ] = [ 'label' => Yii :: t ( 'app' , 'Common' ) ] ; break ; case self :: SECT_CURRENT : $ result [ ] = [ 'label' => Yii :: t ( 'app' , 'Current' ) ] ; break ; } } foreach ( $ items as $ key => $ item ) { $ isActive = isset ( $ item [ 'active' ] ) && $ item [ 'active' ] ; $ isDisabled = isset ( $ item [ 'disabled' ] ) && $ item [ 'disabled' ] ; if ( $ isActive || $ isDisabled ) { if ( $ isDisabled ) { $ item [ 'url' ] = '#' ; \ yii \ helpers \ Html :: addCssClass ( $ item [ 'options' ] , 'disabled' ) ; } if ( isset ( $ item [ 'linkOptions' ] ) && isset ( $ item [ 'linkOptions' ] [ 'data-confirm' ] ) ) { unset ( $ item [ 'linkOptions' ] [ 'data-confirm' ] ) ; } if ( isset ( $ item [ 'linkOptions' ] ) && isset ( $ item [ 'linkOptions' ] [ 'data-method' ] ) ) { unset ( $ item [ 'linkOptions' ] [ 'data-method' ] ) ; } } $ encode = isset ( $ item [ 'encode' ] ) ? $ item [ 'encode' ] : true ; $ label = $ encode ? \ yii \ helpers \ Html :: encode ( $ item [ 'label' ] ) : $ item [ 'label' ] ; if ( isset ( $ item [ 'icon' ] ) ) { $ item [ 'label' ] = '<i class="glyphicon glyphicon-' . $ item [ 'icon' ] . '"></i> ' . $ label ; $ item [ 'encode' ] = false ; unset ( $ item [ 'icon' ] ) ; } $ result [ $ section . '-' . $ key ] = $ item ; } } return $ result ; }
Processess a menu array from an intermediate format to one supported by the Menu widget.
@param array $menu
@param bool $horizontal
@return array
Processess a menu array from an intermediate format to one supported by the Menu widget .