Skip to content

Commit

Permalink
PluginAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
hail committed Apr 24, 2020
1 parent 1b0c4f8 commit 6a4df8f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/assets/PluginAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace hail812\adminlte3\assets;

use yii\web\AssetBundle;

class PluginAsset extends AssetBundle
{
public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins';

public $depends = [
'hail812\adminlte3\assets\AdminLteAsset'
];

public static $pluginMap = [
'icheck-bootstrap' => [
'css' => ['icheck-bootstrap/icheck-bootstrap.css']
]
];

public function add($pluginName)
{
$pluginName = (array) $pluginName;

foreach ($pluginName as $name) {
$plugin = self::$pluginMap[$name];
if (isset($plugin['css'])) {
foreach ($plugin['css'] as $v) {
$this->css[] = $v;
}
}
if (isset($plugin['js'])) {
foreach ($plugin['js'] as $v) {
$this->js[] = $v;
}
}
}

return $this;
}
}

0 comments on commit 6a4df8f

Please sign in to comment.