init
This commit is contained in:
31
components/AssetManager.php
Normal file
31
components/AssetManager.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user