Trait UrlByRoute
Methods summary
public
string
|
#
UrlByRoute( MvcCore\IRoute $route, array & $params = [], string $urlParamRouteName = NULL )
Complete non-absolute, localized or non-localized URL with special media
type prefix or without the prefix by route instance reverse info.
If there is key media_version in $params , unset this param before
route URL completing and choose by this param URL prefix to prepend
completed URL string.
If there is key localization in $params , unset this param before
route url completing and place this param as url prefix to prepend
completed url string and to prepend media site version prefix.
Example:
Input (\MvcCore\Route::$reverse ):
"/products-list/<name>/<color>"
Input ($params):
array(
"name" => "cool-product-name",
"color" => "red",
"variant" => ["L", "XL"],
"media_version" => "mobile",
"localization" => "en-US",
);
Output:
/application/base-bath/m/en-US/products-list/cool-product-name/blue?variant[]=L&variant[]=XL"
Complete non-absolute, localized or non-localized URL with special media
type prefix or without the prefix by route instance reverse info.
If there is key media_version in $params , unset this param before
route URL completing and choose by this param URL prefix to prepend
completed URL string.
If there is key localization in $params , unset this param before
route url completing and place this param as url prefix to prepend
completed url string and to prepend media site version prefix.
Example:
Input (\MvcCore\Route::$reverse ): "/products-list/<name>/<color>"
Input ($params): array( "name" => "cool-product-name", "color" => "red", "variant" => ["L", "XL"], "media_version" => "mobile", "localization" => "en-US", );
Output: /application/base-bath/m/en-US/products-list/cool-product-name/blue?variant[]=L&variant[]=XL"
Parameters
- $route
- $route
- $params
- $urlParamRouteName
Returns
string
|