dmstr / yii2-adminlte-asset

AdminLTE Asset Bundle for Backend Theme in Yii2 Framework
1.14k stars 425 forks source link

no menu divider in left.php possible. #200

Closed olissongs closed 3 years ago

olissongs commented 3 years ago

Hi, hi i tried to add an divider

<?=` dmstr\widgets\Menu::widget(
            [
                'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
                'items' => [
                    ['label' => 'Basic', 'header' => true,'options' => ['style' => 'color:white;padding-left:20px;', 'class'=>'header']],

                    ['label' => 'Menu1', 'options' => ['class'=>'active'],'items' => [
                        ['label' => 'point1','icon' => 'dashboard', 'url' => ['/siten/index']],
                        '<li class="divider"></li>',
                        ['label' => 'point2','icon' => 'dashboard', 'url' => ['/site/index']],

then i get the following error message

PHP Warning – yii\base\ErrorException Illegal string offset 'label'

  1. in /...vendor/dmstr/yii2-adminlte-asset/widgets/Menu.phpat line 150
 protected function normalizeItems($items, &$active)
    {
        foreach ($items as $i => $item) {
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (!isset($item['label'])) {
              $item['label'] = '';                    <== error here marked
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : 
  1. in /.../vendor/dmstr/yii2-adminlte-asset/widgets/Menu.php at line 150– yii\base\ErrorHandler::handleError(2, 'Illegal string offset 'label'', '...', 150,)
        foreach ($items as $i => $item) {
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (!isset($item['label'])) {
                $item['label'] = '';       <== error here marked
            }
            $encodeLabel

Is that impossoble in admin lte?

githubjeka commented 3 years ago

Use separate sections https://github.com/dmstr/yii2-adminlte-asset#left-sidebar-menu---widget-menu