32 lines
780 B
PHP
32 lines
780 B
PHP
<?php
|
|
|
|
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
namespace app\components;
|
|
|
|
/**
|
|
* Description of AssetManager
|
|
*
|
|
* @author Kdg
|
|
*/
|
|
class AssetManager extends \yii\web\AssetManager {
|
|
|
|
public $appendVersion = false;
|
|
|
|
public function getAssetUrl($bundle, $asset) {
|
|
$url = parent::getAssetUrl($bundle, $asset);
|
|
if (is_callable($this->appendVersion)) {
|
|
$this->appendVersion = call_user_func($this->appendVersion);
|
|
}
|
|
if (!empty($this->appendVersion)) {
|
|
$url .= (stripos($url, '?') === false ? '?ver=' : '&ver=') . $this->appendVersion;
|
|
}
|
|
return $url;
|
|
}
|
|
|
|
}
|