-
Notifications
You must be signed in to change notification settings - Fork 0
/
Select2Asset.php
53 lines (45 loc) · 883 Bytes
/
Select2Asset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace maddoger\widgets;
use yii\web\AssetBundle;
use Yii;
class Select2Asset extends AssetBundle
{
/**
* @var string
*/
public $language;
/**
* @inheritdoc
*/
public $sourcePath = '@bower/select2';
/**
* @inheritdoc
*/
public $css = [
'select2.css',
//'select2-bootstrap.css',
];
/**
* @inheritdoc
*/
public $js = [
'select2.min.js',
];
/**
* @inheritdoc
*/
public $depends = [
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
];
public function init()
{
parent::init();
if (!$this->language) {
$this->language = substr(Yii::$app->language, 0, 2);
}
if ($this->language != 'en') {
$this->js[] = 'select2_locale_'.$this->language.'.js';
}
}
}