devnullius/yii2-admin-lte

Extension for adminLTE3 theme quick usage

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.0 2020-09-17 04:02 UTC

This package is auto-updated.

Last update: 2022-09-17 10:04:34 UTC


README

adminlte3 for yii2

https://adminlte.io/themes/v3/

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist devnullius/yii2-admin-lte "^1.0.0"

or add

"devnullius/yii2-admin-lte": "^1.0.0"

to the require section of your composer.json file.

Usage

Once the extension is installed, you can config the path mappings of the view component:

'components' => [
    'view' => [
         'theme' => [
             'pathMap' => [
                '@app/views' => '@vendor/devnullius/yii2-admin-lte/src/views'
             ],
         ],
    ],
],

Copy files from @vendor/devnullius/adminlte/src/views to @app/views, then edit.

simply use:

<?php
use devnullius\adminlte\widgets\Alert;
?>
<?= Alert::widget([
    'type' => 'success',
    'body' => '<h3>Congratulations!</h3>'
]) ?>

AdminLTE Plugins

AdminLTE Plugins are not included in AdminLteAsset, if you want to use any of them you can add it dynamically with PluginAsset. For example:

/* @var $this View */

use devnullius\adminlte\assets\PluginAsset;

PluginAsset::register($this)->add('sweetalert2');

before this, maybe you should edit params.php:

return [
    'adminEmail' => 'admin@example.com',
    'devnullius.adminlte' => [
        'pluginMap' => [
            'sweetalert2' => [
                'css' => 'sweetalert2-theme-bootstrap-4/bootstrap-4.min.css',
                'js' => 'sweetalert2/sweetalert2.min.js'
            ]
        ]
    ]
];

or

/* @var $this View */

use devnullius\adminlte\assets\PluginAsset;

$bundle = PluginAsset::register($this);
$bundle->css[] = 'sweetalert2-theme-bootstrap-4/bootstrap-4.min.css';
$bundle->js[] = 'sweetalert2/sweetalert2.min.js';