wolfpack-it / yii2-admin-lte
Admin LTE 3 theme and widgets for Yii2.
v1.0.1
2021-03-08 11:32 UTC
Requires
- php: >=7.1.0
- almasaeed2010/adminlte: ^3.0.2
- kartik-v/yii2-icons: ^1.4.5
- yiisoft/yii2: ~2.0.19
- yiisoft/yii2-bootstrap4: ~2.0.1
This package is auto-updated.
Last update: 2024-12-08 19:55:48 UTC
README
This extension provides Admin LTE 3 bundles and widgets for the Yii2 Framework.
Installation
The preferred way to install this extension is through composer.
Either run
$ composer require wolfpack-it/yii2-admin-lte
or add
"wolfpack-it/yii2-admin-lte": "^<latest version>"
to the require
section of your composer.json
file.
Usage
Asset bundle
To use the style, the register bundle must be configured (this is also automatically done by the widgets).
$this->registerAssetBundle(\WolfpackIT\adminLte\bundles\AdminLteBundle::class);
Example HTML layout
Base HTML example of structure and additions to use Admin LTE.
Body
<body class="hold-transition sidebar-mini layout-fixed"> <div class="wrapper"> <!-- menu --> <!-- sidebar --> <div class="content-wrapper"> <div class="content-header"> <!-- header in container --> </div> <section class="content"> <!-- content in container--> </section> </div> <!-- footer --> </div> </body>
Menu
echo \yii\bootstrap4\NavBar::begin([ 'options' => [ 'class' => ['main-header', 'navbar-expand', 'navbar-light', 'border-bottom'], ], 'renderInnerContainer' => false ]); echo \yii\bootstrap4\Nav::widget([ 'options' => ['class' => 'navbar-nav'], 'items' => [ ['label' => \kartik\icons\Icon::show('bars'), 'linkOptions' => ['data-widget' => 'pushmenu'], 'encode' => false], ], ]); echo \yii\bootstrap4\Nav::widget([ 'options' => ['class' => 'navbar-nav ml-auto'], 'items' => [ ['label' => \Yii::t( 'app', 'Home'), 'url' => \Yii::$app->homeUrl], ], ]); NavBar::end();
Sidebar
\WolfpackIT\adminLte\widgets\SideNavBar::begin([ 'brandLabel' => \Yii::t('app', 'Urban Journalist'), 'brandTextOptions' => ['class' => ['font-weight-light']], 'brandUrl' => ['/'], ]); echo \WolfpackIT\adminLte\widgets\SideNavBarUserPanel::widget([ 'icon' => 'user-secret', 'label' => 'Guest', 'url' => ['session/create'] ]); echo \WolfpackIT\adminLte\widgets\SideNav::widget([ 'items' => [ [ 'icon' => 'home', 'label' => \Yii::t('app', 'Home'), 'url' => ['site/index'], ], [ 'icon' => 'star', 'label' => \Yii::t('app', 'Submenu'), 'items' => [ [ 'icon' => 'circle', 'label' => \Yii::t('app', 'Submenu item'), 'url' => ['site/index'], ] ] ] ], ]); \WolfpackIT\adminLte\widgets\SideNavBar::end();
Footer
TBD
TODO
- Add tests
Credits
License
The MIT License (MIT). Please see LICENSE for more information.