Conditions | 4 |
Paths | 8 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function withScripts($scripts = ['highcharts']) |
||
31 | { |
||
32 | // use unminified files when in debug mode |
||
33 | $ext = YII_DEBUG ? 'src.js' : 'js'; |
||
34 | |||
35 | // add files |
||
36 | foreach ($scripts as $script) { |
||
37 | $this->js[] = "$script.$ext"; |
||
38 | } |
||
39 | |||
40 | // make sure that either highcharts or highstock base file is included. |
||
41 | array_unshift($this->js, "highcharts.$ext"); |
||
42 | $hasHighstock = in_array("highstock.$ext", $this->js); |
||
43 | if ($hasHighstock) { |
||
44 | array_unshift($this->js, "highstock.$ext"); |
||
45 | // remove highcharts if highstock is used on page |
||
46 | $this->js = array_diff($this->js, ["highcharts.$ext"]); |
||
47 | } |
||
48 | |||
49 | return $this; |
||
50 | } |
||
51 | } |
||
52 |