Fixes #2426: Changed URL creation method signatures to be consistent

This commit is contained in:
Alexander Makarov
2014-02-20 20:10:33 +04:00
parent 1c9cfc0105
commit 43c17d99cc
23 changed files with 84 additions and 83 deletions

View File

@ -1489,12 +1489,10 @@ class BaseHtml
{
if (is_array($url)) {
if (isset($url[0])) {
$route = $url[0];
$params = array_splice($url, 1);
if (Yii::$app->controller instanceof \yii\web\Controller) {
return Yii::$app->controller->createUrl($route, $params);
return Yii::$app->controller->createUrl($url);
} else {
return Yii::$app->getUrlManager()->createUrl($route, $params);
return Yii::$app->getUrlManager()->createUrl($url);
}
} else {
throw new InvalidParamException('The array specifying a URL must contain at least one element.');