helpers\BaseUrl normalizeRoute()

normalizeRoute() protected static method

Normalizes route and makes it suitable for UrlManager. Absolute routes are staying as is while relative routes are converted to absolute ones.

A relative route is a route without a leading slash, such as "view", "post/view".

  • If the route is an empty string, the current route will be used;
  • If the route contains no slashes at all, it is considered to be an action ID of the current controller and will be prepended with yii\web\Controller::$uniqueId;
  • If the route has no leading slash, it is considered to be a route relative to the current module and will be prepended with the module's uniqueId.

Starting from version 2.0.2, a route can also be specified as an alias. In this case, the alias will be converted into the actual route first before conducting the above transformation steps.

protected static string normalizeRoute ( $route )
$route string

The route. This can be either an absolute route or a relative route.

return string

Normalized route suitable for UrlManager

throws yii\base\InvalidParamException

a relative route is given while there is no active controller

doc_Yii
2016-10-30 17:05:33
Comments
Leave a Comment

Please login to continue.