forked from MihailDev/yii2-elfinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssets.php
47 lines (40 loc) · 1.12 KB
/
Assets.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
<?php
namespace mihaildev\elfinder;
use yii\web\AssetBundle;
use yii\web\JqueryAsset;
class Assets extends AssetBundle
{
public $css = array(
'css/elfinder.min.css',
'css/theme.css',
);
public $js = array(
'js/elfinder.min.js'
);
public $depends = array(
'yii\jui\JuiAsset',
);
public function init()
{
$this->sourcePath = __DIR__."/assets";
parent::init();
}
/**
* @param string $lang
* @param \yii\web\View $view
*/
public static function addLangFile($lang, $view){
$lang = ElFinder::getSupportedLanguage($lang);
if ($lang !== false && $lang !== 'en'){
list(,$path) = \Yii::$app->assetManager->publish(__DIR__."/assets");
$view->registerJsFile($path.'/js/i18n/elfinder.' . $lang . '.js', ['depends' => [Assets::className()]]);
}
}
/**
* @param \yii\web\View $view
*/
public static function noConflict($view){
list(,$path) = \Yii::$app->assetManager->publish(__DIR__."/assets");
$view->registerJsFile($path.'/js/no.conflict.js', ['depends' => [JqueryAsset::className()]]);
}
}