File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 29
29
"php" : " >=5.5.0" ,
30
30
"yiisoft/yii2" : " ~2.0.13" ,
31
31
"bower-asset/datatables" : " ~1.10.15" ,
32
- "bower-asset/datatables-plugins" : " ~1.10.15"
32
+ "bower-asset/datatables-plugins" : " ~1.10.15" ,
33
+ "bower-asset/datatables.net-bs4" : " ~1.10.15" ,
34
+ "npm-asset/datatables.net-bs5" : " ~1.10.15"
33
35
},
34
36
"autoload" : {
35
37
"psr-4" : {
Original file line number Diff line number Diff line change 12
12
13
13
class DataTableBootstrapAsset extends AssetBundle
14
14
{
15
- public $ sourcePath = '@bower/datatables-plugins/integration/bootstrap/3 ' ;
16
-
17
15
public $ depends = [
18
16
DataTableBaseAsset::class,
19
17
];
@@ -22,9 +20,24 @@ public function init()
22
20
{
23
21
parent ::init ();
24
22
25
- $ this ->depends [] = 'yii\bootstrap\BootstrapAsset ' ;
26
- $ this ->css [] = 'dataTables.bootstrap.css ' ;
27
- $ this ->js [] = 'dataTables.bootstrap ' . (YII_ENV_DEV ? '' : '.min ' ) . '.js ' ;
23
+ if (class_exists ('yii\bootstrap\BootstrapAsset ' )) {
24
+ $ this ->sourcePath = '@bower/datatables-plugins/integration/bootstrap/3 ' ;
25
+ $ this ->depends [] = 'yii\bootstrap\BootstrapAsset ' ;
26
+ $ this ->css [] = 'dataTables.bootstrap.css ' ;
27
+ $ this ->js [] = 'dataTables.bootstrap ' . (YII_ENV_DEV ? '' : '.min ' ) . '.js ' ;
28
+
29
+ } else if (class_exists ('yii\bootstrap4\BootstrapAsset ' )) {
30
+ $ this ->sourcePath = '@bower/datatables.net-bs4 ' ;
31
+ $ this ->depends [] = 'yii\bootstrap4\BootstrapAsset ' ;
32
+ $ this ->css [] = 'css\dataTables.bootstrap4.css ' ;
33
+ $ this ->js [] = 'js\dataTables.bootstrap4 ' . (YII_ENV_DEV ? '' : '.min ' ) . '.js ' ;
34
+
35
+ } else {
36
+ $ this ->sourcePath = '@npm/datatables.net-bs5 ' ;
37
+ $ this ->depends [] = 'yii\bootstrap5\BootstrapAsset ' ;
38
+ $ this ->css [] = 'css\dataTables.bootstrap5.css ' ;
39
+ $ this ->js [] = 'js\dataTables.bootstrap5 ' . (YII_ENV_DEV ? '' : '.min ' ) . '.js ' ;
40
+ }
28
41
}
29
42
30
43
}
You can’t perform that action at this time.
0 commit comments