potime / yii2-adminlte4
AdminLTE 4 for Yii 2.0 Framework
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=8.3
- almasaeed2010/adminlte: ^4.0
- npm-asset/fontsource--source-sans-3: ^5.2.0
- npm-asset/fortawesome--fontawesome-free: ^6.7.2
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-bootstrap5: ~2.0.50
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist potime/yii2-adminlte4 "*"
or add
"potime/yii2-adminlte4": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
'components' => [ 'view' => [ 'theme' => [ 'pathMap' => [ '@app/views' => '@vendor/potime/yii2-adminlte4/src/example/yii2-views' ], ], ], ],
This asset bundle provides sample files for layout and view (see folder examples/
), they are not meant to be customized directly in the vendor/
folder.
Therefore it is recommended to copy the views into your application and adjust them to your needs.
Customization
Widget Menu (Left Sidebar)
'items' => [ [ 'label' => 'YII Tools', 'iconType' => 'far', 'icon' => 'share', 'badge' => ['message' => 'New', 'badgeType' => 'danger'], 'items' => [ ['label' => 'Login', 'url' => ['site/login'], 'icon' => 'sign-in-alt', 'visible' => Yii::$app->user->isGuest], ['label' => 'Gii', 'url' => ['/gii'], 'icon' => 'file-code', 'target' => '_blank'], ['label' => 'Debug', 'url' => ['/debug'], 'icon' => 'bug', 'target' => '_blank', 'badge' => ['badgeType' => 'warning', 'message' => 2]], ] ], ]
Layouts (login)
Use the code in your controller.
$this->layout = '/main-login';
Template for Gii CRUD generator
Tell Gii about our template. The setting is made in the config file:
if (!YII_ENV_TEST) { $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'generators' => [ 'crud' => [ 'class' => 'yii\gii\generators\crud\Generator', 'templates' => [ 'adminlte3' => '@vendor/potime/yii2-adminlte3/src/gii/generators/crud/adminlte3' ] ] ] ]; }