BootstrapAsset::init()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 16
c 0
b 0
f 0
rs 9.9
cc 2
nc 2
nop 0
1
<?php
2
3
namespace backend\assets;
4
5
use Yii;
6
use yii\web\AssetBundle;
7
use yii\bootstrap\BootstrapAsset as YiiBootstrapAsset;
8
use yii\bootstrap\BootstrapPluginAsset as YiiBootstrapPluginAsset;
9
use yii\web\YiiAsset;
10
11
/**
12
 * Class BootstrapAsset
13
 * @package backend\assets
14
 */
15
class BootstrapAsset extends AssetBundle
16
{
17
    /**
18
     * @var string
19
     */
20
    public $sourcePath = '@vendor/almasaeed2010/adminlte/bower_components/bootstrap/dist';
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function init()
26
    {
27
        parent::init();
28
        $min = YII_ENV_DEV ? '' : '.min';
29
        $this->css = ['css/bootstrap' . $min . '.css'];
30
        $this->js = ['js/bootstrap' . $min . '.js'];
31
32
        // Подключаем свои файлы Bootstrap
33
        $assetManager = Yii::$app->assetManager;
34
        $assetManager->bundles[YiiBootstrapAsset::class] = [
35
            'sourcePath' => $this->sourcePath,
36
            'css' => [$this->css]
37
        ];
38
        $assetManager->bundles[YiiBootstrapPluginAsset::class] = [
39
            'sourcePath' => $this->sourcePath,
40
            'js' => [$this->js]
41
        ];
42
    }
43
44
    public $depends = [
45
        YiiAsset::class
46
    ];
47
}
48