forked from andrewblake1/yii2-summernote-widget
-
Notifications
You must be signed in to change notification settings - Fork 18
/
SummernoteAsset.php
42 lines (36 loc) · 1.18 KB
/
SummernoteAsset.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
<?php
namespace marqu3s\summernote;
use Yii;
use yii\web\AssetBundle;
class SummernoteAsset extends AssetBundle
{
public $baseUrl = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/';
/** @var array */
public $depends = ['yii\bootstrap\BootstrapPluginAsset'];
/**
* @inheritdoc
*/
public function init()
{
if (
isset(Yii::$app->params['bsVersion']) &&
substr(Yii::$app->params['bsVersion'], 0, 1) == '5'
) {
$this->depends = ['yii\bootstrap5\BootstrapPluginAsset'];
$this->css[] = 'summernote-bs5.min.css';
$this->js[] = 'summernote-bs5.min.js';
} elseif (
isset(Yii::$app->params['bsVersion']) &&
substr(Yii::$app->params['bsVersion'], 0, 1) == '4'
) {
$this->depends = ['yii\bootstrap4\BootstrapPluginAsset'];
$this->css[] = 'summernote-bs4.min.css';
$this->js[] = 'summernote-bs4.min.js';
} else {
$this->depends = ['yii\bootstrap\BootstrapPluginAsset'];
$this->css[] = 'summernote.min.css';
$this->js[] = 'summernote.min.js';
}
parent::init();
}
}