From efaaec1cbfdb16d964b745d0a6c4432c5ec57566 Mon Sep 17 00:00:00 2001 From: vova07 Date: Fri, 31 Jan 2014 19:48:49 +0200 Subject: [PATCH] Improved to support aliases. Fixes #2240. --- framework/CHANGELOG.md | 1 + framework/web/AssetManager.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index dfc0ac3..a4177e5 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -114,6 +114,7 @@ Yii Framework 2 Change Log - Enh: Added `yii\web\View::POS_LOAD` (qiangxue) - Enh: Added `yii\web\Response::clearOutputBuffers()` (qiangxue) - Enh: Improved `QueryBuilder::buildLimit()` to support big numbers (qiangxue) +- Enh #2240: Improved `yii\web\AssetManager::publish()`, `yii\web\AssetManager::getPublishedPath()` and `yii\web\AssetManager::getPublishedUrl()` to support aliases (vova07) - Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue) - Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue) - Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue) diff --git a/framework/web/AssetManager.php b/framework/web/AssetManager.php index bc06fe7..ab38b47 100644 --- a/framework/web/AssetManager.php +++ b/framework/web/AssetManager.php @@ -223,6 +223,8 @@ class AssetManager extends Component */ public function publish($path, $options = []) { + $path = Yii::getAlias($path); + if (isset($this->_published[$path])) { return $this->_published[$path]; } @@ -291,6 +293,8 @@ class AssetManager extends Component */ public function getPublishedPath($path) { + $path = Yii::getAlias($path); + if (isset($this->_published[$path])) { return $this->_published[$path][0]; } @@ -315,6 +319,8 @@ class AssetManager extends Component */ public function getPublishedUrl($path) { + $path = Yii::getAlias($path); + if (isset($this->_published[$path])) { return $this->_published[$path][1]; }