Commit bc9b62c3 by Carsten Brandt

url of CSS and JS files registered in View can be url alias

fixes #2132, fixes #2133
parent aacbdd83
...@@ -87,6 +87,7 @@ Yii Framework 2 Change Log ...@@ -87,6 +87,7 @@ Yii Framework 2 Change Log
- Enh #2101: Gii is now using model labels when generating search (thiagotalma) - Enh #2101: Gii is now using model labels when generating search (thiagotalma)
- Enh #2103: Renamed AccessDeniedHttpException to ForbiddenHttpException, added new commonly used HTTP exception classes (danschmidt5189) - Enh #2103: Renamed AccessDeniedHttpException to ForbiddenHttpException, added new commonly used HTTP exception classes (danschmidt5189)
- Enh #2124: Added support for UNION ALL queries (Ivan Pomortsev, iworker) - Enh #2124: Added support for UNION ALL queries (Ivan Pomortsev, iworker)
- Enh #2132: Allow url of CSS and JS files registered in yii\web\View to be url alias (cebe)
- Enh: Added `favicon.ico` and `robots.txt` to default application templates (samdark) - Enh: Added `favicon.ico` and `robots.txt` to default application templates (samdark)
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue) - Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
- Enh: Support for file aliases in console command 'message' (omnilight) - Enh: Support for file aliases in console command 'message' (omnilight)
......
...@@ -312,6 +312,7 @@ class View extends \yii\base\View ...@@ -312,6 +312,7 @@ class View extends \yii\base\View
*/ */
public function registerCssFile($url, $depends = [], $options = [], $key = null) public function registerCssFile($url, $depends = [], $options = [], $key = null)
{ {
$url = Yii::getAlias($url);
$key = $key ?: $url; $key = $key ?: $url;
if (empty($depends)) { if (empty($depends)) {
$this->cssFiles[$key] = Html::cssFile($url, $options); $this->cssFiles[$key] = Html::cssFile($url, $options);
...@@ -369,6 +370,7 @@ class View extends \yii\base\View ...@@ -369,6 +370,7 @@ class View extends \yii\base\View
*/ */
public function registerJsFile($url, $depends = [], $options = [], $key = null) public function registerJsFile($url, $depends = [], $options = [], $key = null)
{ {
$url = Yii::getAlias($url);
$key = $key ?: $url; $key = $key ?: $url;
if (empty($depends)) { if (empty($depends)) {
$position = isset($options['position']) ? $options['position'] : self::POS_END; $position = isset($options['position']) ? $options['position'] : self::POS_END;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment