dev-master
9999999-devA Bootstrap Treeview Generator for AdminLte Sidebar
MIT
The Requires
by chuan xiong
extension yii2 generator adminlte treeview sidebar
                         Wallogit.com
                    
                    2017 © Pedro Peláez
                    
                    
                    
                    
                
                
            
A Bootstrap Treeview Generator for AdminLte Sidebar
A Bootstrap Treeview Generator for AdminLte Sidebar,Based meysampg/yii2-treeview, (*1)
对 meysampg/yii2-treeview treemenu进行了简单的增强,原作者merge的太慢,我fork了一个。, (*2)
It's just an extended version of yii\bootstrap\Nav for generating proper code for sidebar of AdminLte with support of badgets., (*3)
The preferred way to install this extension is through composer., (*4)
Either run, (*5)
composer require xiongchuan/yii2-adminlte-treeview "*"
or add, (*6)
"xiongchuan/yii2-adminlte-treeview": "*"
to the require section of your composer.json file., (*7)
Once the extension is installed, simply use it in your code by:, (*8)
use xiongchuan\treeview\Treeview;
and use it on your code by, (*9)
<!-- sidebar menu: : style can be found in sidebar.less -->
<?= Treeview::widget([
    'items' => [
      [
          'label' => Yii::t('app', 'Dashboard'),
          'icon' => 'fa fa-dashboard',
          'url' => Url::home(),
      ],
      [
          'label' => Yii::t('app', 'Messages'),
          'icon' => 'fa fa-envelope',
          'items' => [
              [
                  'label' => Yii::t('app', 'Inbox'),
                  'url' => ['/message/inbox'],
              ],
              [
                  'label' => Yii::t('app', 'Outbox'),
                  'url' => ['/message/outbox'],
              ],
              [
                  'label' => Yii::t('app', 'Create'),
                  'url' => ['/message/create'],
              ],
          ],
      ],
    ]
]) ?>
And simply output is what is needed:, (*10)
, (*11)
Here is a RTL example:, (*12)
<!-- sidebar menu: : style can be found in sidebar.less -->
<?= Treeview::widget([
    'items' => [
        [
            'label' => 'داشبورد',
            'icon' => 'fa fa-dashboard',
            'url' => Url::home(),
        ],
        [
            'label' => 'پیامها',
            'icon' => 'fa fa-envelope',
            'items' => [
                [
                    'label' => 'صندوق ورودی',
                    'url' => ['/message/inbox'],
                    'badget' => [
                        'text' => 4,
                        'color' => 'label-info',
                        'float' => 'left',
                    ],
                ],
                [
                    'label' => 'صندوق خروجی',
                    'url' => ['/message/outbox'],
                ],
                [
                    'label' => 'ایجاد پیام',
                    'url' => ['/message/create'],
                ],
            ],
        ],
    ]
]) ?>
, (*13)
and a LTR example:, (*14)
<!-- sidebar menu: : style can be found in sidebar.less -->
<?= Treeview::widget([
    'items' => [
        [
            'label' => 'Dashboard',
            'icon' => 'fa fa-dashboard',
            'url' => Url::home(),
        ],
        [
            'label' => 'Message',
            'icon' => 'fa fa-envelope',
            'items' => [
                [
                    'label' => 'Inbox',
                    'url' => ['/message/inbox'],
                    'badget' => [
                        'text' => 4,
                        'color' => 'label-info',
                    ],
                ],
                [
                    'label' => 'Outbox',
                    'url' => ['/message/outbox'],
                ],
                [
                    'label' => 'Create',
                    'url' => ['/message/create'],
                ],
            ],
        ],
    ]
]) ?>
, (*15)
There is no much configuration for this extension. Just it's needed to send an array of sidebar items to items property of Treeview. Also for color property of badget It can be a CSS class with color, for continence you can  use this values:, (*16)
label-defaultlabel-successlabel-infolabel-dangerlabel-warningReport bugs, request a feature or do your modification and send a pull request :)., (*17)
A Bootstrap Treeview Generator for AdminLte Sidebar
MIT
extension yii2 generator adminlte treeview sidebar